@@ -170,12 +170,14 @@ class TKqpTableWriteActor : public TActorBootstrapped<TKqpTableWriteActor> {
170170 const bool inconsistentTx,
171171 const NMiniKQL::TTypeEnvironment& typeEnv,
172172 std::shared_ptr<NKikimr::NMiniKQL::TScopedAlloc> alloc,
173+ const NKikimrDataEvents::TMvccSnapshot& mvccSnapshot,
173174 const IKqpTransactionManagerPtr& txManager,
174175 const TActorId sessionActorId,
175176 TIntrusivePtr<TKqpCounters> counters,
176177 NWilson::TTraceId traceId)
177178 : TypeEnv(typeEnv)
178179 , Alloc(alloc)
180+ , MvccSnapshot(mvccSnapshot)
179181 , TableId(tableId)
180182 , TablePath(tablePath)
181183 , LockTxId(lockTxId)
@@ -813,6 +815,7 @@ class TKqpTableWriteActor : public TActorBootstrapped<TKqpTableWriteActor> {
813815 FillEvWritePrepare (evWrite.get (), shardId, *TxId, TxManager);
814816 } else if (!InconsistentTx) {
815817 evWrite->SetLockId (LockTxId, LockNodeId);
818+ *evWrite->Record .MutableMvccSnapshot () = MvccSnapshot;
816819 }
817820
818821 const auto serializationResult = ShardedWriteController->SerializeMessageToPayload (shardId, *evWrite);
@@ -954,6 +957,8 @@ class TKqpTableWriteActor : public TActorBootstrapped<TKqpTableWriteActor> {
954957 const NMiniKQL::TTypeEnvironment& TypeEnv;
955958 std::shared_ptr<NKikimr::NMiniKQL::TScopedAlloc> Alloc;
956959
960+ NKikimrDataEvents::TMvccSnapshot MvccSnapshot;
961+
957962 const TTableId TableId;
958963 const TString TablePath;
959964
@@ -1019,6 +1024,7 @@ class TKqpDirectWriteActor : public TActorBootstrapped<TKqpDirectWriteActor>, pu
10191024 Settings.GetInconsistentTx (),
10201025 TypeEnv,
10211026 Alloc,
1027+ Settings.GetMvccSnapshot (),
10221028 nullptr ,
10231029 TActorId{},
10241030 Counters,
@@ -1206,6 +1212,7 @@ struct TTransactionSettings {
12061212 ui64 LockTxId = 0 ;
12071213 ui64 LockNodeId = 0 ;
12081214 bool InconsistentTx = false ;
1215+ NKikimrDataEvents::TMvccSnapshot MvccSnapshot;
12091216};
12101217
12111218struct TWriteSettings {
@@ -1316,10 +1323,14 @@ class TKqpBufferWriteActor :public TActorBootstrapped<TKqpBufferWriteActor>, pub
13161323 AFL_ENSURE (LockTxId == settings.TransactionSettings .LockTxId );
13171324 AFL_ENSURE (LockNodeId == settings.TransactionSettings .LockNodeId );
13181325 AFL_ENSURE (InconsistentTx == settings.TransactionSettings .InconsistentTx );
1326+ AFL_ENSURE (MvccSnapshot.GetStep () == settings.TransactionSettings .MvccSnapshot .GetStep ());
1327+ AFL_ENSURE (MvccSnapshot.GetTxId () == settings.TransactionSettings .MvccSnapshot .GetTxId ());
13191328 } else {
13201329 LockTxId = settings.TransactionSettings .LockTxId ;
13211330 LockNodeId = settings.TransactionSettings .LockNodeId ;
13221331 InconsistentTx = settings.TransactionSettings .InconsistentTx ;
1332+ MvccSnapshot.SetStep (settings.TransactionSettings .MvccSnapshot .GetStep ());
1333+ MvccSnapshot.SetTxId (settings.TransactionSettings .MvccSnapshot .GetTxId ());
13231334 }
13241335
13251336 auto & writeInfo = WriteInfos[settings.TableId ];
@@ -1333,6 +1344,7 @@ class TKqpBufferWriteActor :public TActorBootstrapped<TKqpBufferWriteActor>, pub
13331344 InconsistentTx,
13341345 TypeEnv,
13351346 Alloc,
1347+ MvccSnapshot,
13361348 TxManager,
13371349 SessionActorId,
13381350 Counters,
@@ -2011,6 +2023,7 @@ class TKqpBufferWriteActor :public TActorBootstrapped<TKqpBufferWriteActor>, pub
20112023
20122024 std::shared_ptr<NKikimr::NMiniKQL::TScopedAlloc> Alloc;
20132025 NMiniKQL::TTypeEnvironment TypeEnv;
2026+ NKikimrDataEvents::TMvccSnapshot MvccSnapshot;
20142027
20152028 struct TWriteInfo {
20162029 TKqpTableWriteActor* WriteTableActor = nullptr ;
@@ -2137,6 +2150,7 @@ class TKqpForwardWriteActor : public TActorBootstrapped<TKqpForwardWriteActor>,
21372150 .LockTxId = Settings.GetLockTxId (),
21382151 .LockNodeId = Settings.GetLockNodeId (),
21392152 .InconsistentTx = Settings.GetInconsistentTx (),
2153+ .MvccSnapshot = Settings.GetMvccSnapshot (),
21402154 },
21412155 .Priority = Settings.GetPriority (),
21422156 };
0 commit comments