Skip to content

Commit ec89d22

Browse files
authored
Remove TActiveTransaction from datashard_kqp (#1454)
1 parent f2e86bd commit ec89d22

10 files changed

+132
-154
lines changed

ydb/core/tx/datashard/build_kqp_data_tx_out_rs_unit.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ EExecutionStatus TBuildKqpDataTxOutRSUnit::Execute(TOperation::TPtr op, TTransac
100100
dataTx->SetReadVersion(DataShard.GetReadWriteVersions(tx).ReadVersion);
101101

102102
if (dataTx->GetKqpComputeCtx().HasPersistentChannels()) {
103-
auto result = KqpRunTransaction(ctx, op->GetTxId(), kqpLocks, useGenericReadSets, tasksRunner);
103+
auto result = KqpRunTransaction(ctx, op->GetTxId(), useGenericReadSets, tasksRunner);
104104

105105
Y_VERIFY_S(!dataTx->GetKqpComputeCtx().HadInconsistentReads(),
106106
"Unexpected inconsistent reads in operation " << *op << " when preparing persistent channels");

ydb/core/tx/datashard/datashard__engine_host.cpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class TDataShardEngineHost final
276276
return UserDb.GetChangeCollector(tableId);
277277
}
278278

279-
void CommitChanges(const TTableId& tableId, ui64 lockId, const TRowVersion& writeVersion) {
279+
void CommitChanges(const TTableId& tableId, ui64 lockId, const TRowVersion& writeVersion) override {
280280
UserDb.CommitChanges(tableId, lockId, writeVersion);
281281
}
282282

@@ -607,13 +607,6 @@ void TEngineBay::SetIsRepeatableSnapshot() {
607607
host->SetIsRepeatableSnapshot();
608608
}
609609

610-
void TEngineBay::CommitChanges(const TTableId& tableId, ui64 lockId, const TRowVersion& writeVersion) {
611-
Y_ABORT_UNLESS(EngineHost);
612-
613-
auto* host = static_cast<TDataShardEngineHost*>(EngineHost.Get());
614-
host->CommitChanges(tableId, lockId, writeVersion);
615-
}
616-
617610
TVector<IDataShardChangeCollector::TChange> TEngineBay::GetCollectedChanges() const {
618611
Y_ABORT_UNLESS(EngineHost);
619612

ydb/core/tx/datashard/datashard__engine_host.h

-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ class TEngineBay : TNonCopyable {
103103
void SetIsImmediateTx();
104104
void SetIsRepeatableSnapshot();
105105

106-
void CommitChanges(const TTableId& tableId, ui64 lockId, const TRowVersion& writeVersion);
107-
108106
TVector<IDataShardChangeCollector::TChange> GetCollectedChanges() const;
109107
void ResetCollectedChanges();
110108

ydb/core/tx/datashard/datashard_active_transaction.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ TValidatedDataTx::~TValidatedDataTx() {
206206
NActors::NMemory::TLabel<MemoryLabelValidatedDataTx>::Sub(TxSize);
207207
}
208208

209+
TDataShardUserDb& TValidatedDataTx::GetUserDb() {
210+
return EngineBay.GetUserDb();
211+
}
212+
const TDataShardUserDb& TValidatedDataTx::GetUserDb() const {
213+
return EngineBay.GetUserDb();
214+
}
215+
209216
ui32 TValidatedDataTx::ExtractKeys(bool allowErrors)
210217
{
211218
using EResult = NMiniKQL::IEngineFlat::EResult;

ydb/core/tx/datashard/datashard_active_transaction.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ using NTabletFlatExecutor::TTransactionContext;
2323
using NTabletFlatExecutor::TTableSnapshotContext;
2424

2525
class TDataShard;
26+
class TDataShardUserDb;
2627
class TSysLocks;
2728
struct TReadSetKey;
2829
class TActiveTransaction;
@@ -173,17 +174,16 @@ class TValidatedDataTx : TNonCopyable {
173174
const NMiniKQL::TEngineHostCounters& GetCounters() { return EngineBay.GetCounters(); }
174175
void ResetCounters() { EngineBay.ResetCounters(); }
175176

177+
TDataShardUserDb& GetUserDb();
178+
const TDataShardUserDb& GetUserDb() const;
179+
176180
bool CanCancel();
177181
bool CheckCancelled(ui64 tabletId);
178182

179183
void SetWriteVersion(TRowVersion writeVersion) { EngineBay.SetWriteVersion(writeVersion); }
180184
void SetReadVersion(TRowVersion readVersion) { EngineBay.SetReadVersion(readVersion); }
181185
void SetVolatileTxId(ui64 txId) { EngineBay.SetVolatileTxId(txId); }
182186

183-
void CommitChanges(const TTableId& tableId, ui64 lockId, const TRowVersion& writeVersion) {
184-
EngineBay.CommitChanges(tableId, lockId, writeVersion);
185-
}
186-
187187
TVector<IDataShardChangeCollector::TChange> GetCollectedChanges() const { return EngineBay.GetCollectedChanges(); }
188188
void ResetCollectedChanges() { EngineBay.ResetCollectedChanges(); }
189189

0 commit comments

Comments
 (0)