File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -151,9 +151,11 @@ void TTxWrite::Complete(const TActorContext& ctx) {
151151 if (!writeMeta.HasLongTxId ()) {
152152 auto op = Self->GetOperationsManager ().GetOperationVerified ((TOperationWriteId)writeMeta.GetWriteId ());
153153 if (op->GetBehaviour () == EOperationBehaviour::WriteWithLock || op->GetBehaviour () == EOperationBehaviour::NoTxWrite) {
154- auto evWrite = std::make_shared<NOlap::NTxInteractions::TEvWriteWriter>(writeMeta.GetTableId (),
155- buffer.GetAggregations ()[i]->GetRecordBatch (), Self->GetIndexOptional ()->GetVersionedIndex ().GetPrimaryKey ());
156- Self->GetOperationsManager ().AddEventForLock (*Self, op->GetLockId (), evWrite);
154+ if (op->GetBehaviour () != EOperationBehaviour::NoTxWrite || Self->GetOperationsManager ().HasReadLocks (writeMeta.GetTableId ())) {
155+ auto evWrite = std::make_shared<NOlap::NTxInteractions::TEvWriteWriter>(writeMeta.GetTableId (),
156+ buffer.GetAggregations ()[i]->GetRecordBatch (), Self->GetIndexOptional ()->GetVersionedIndex ().GetPrimaryKey ());
157+ Self->GetOperationsManager ().AddEventForLock (*Self, op->GetLockId (), evWrite);
158+ }
157159 }
158160 if (op->GetBehaviour () == EOperationBehaviour::NoTxWrite) {
159161 Self->OperationsManager ->AddTemporaryTxLink (op->GetLockId ());
Original file line number Diff line number Diff line change @@ -208,6 +208,10 @@ class TOperationsManager {
208208 }
209209 }
210210
211+ bool HasReadLocks (const ui64 pathId) const {
212+ return InteractionsContext.HasReadIntervals (pathId);
213+ }
214+
211215 TOperationsManager ();
212216
213217private:
Original file line number Diff line number Diff line change @@ -400,6 +400,10 @@ class TInteractionsContext {
400400 THashMap<ui64, TReadIntervals> ReadIntervalsByPathId;
401401
402402public:
403+ bool HasReadIntervals (const ui64 pathId) const {
404+ return ReadIntervalsByPathId.contains (pathId);
405+ }
406+
403407 NJson::TJsonValue DebugJson () const {
404408 NJson::TJsonValue result = NJson::JSON_MAP;
405409 for (auto && i : ReadIntervalsByPathId) {
You can’t perform that action at this time.
0 commit comments