From 0a733ba6c5d16cdf48d8c95609ce26ca52027c13 Mon Sep 17 00:00:00 2001 From: ivanmorozov333 Date: Mon, 23 Sep 2024 21:18:47 +0300 Subject: [PATCH] remove useless locks broking checker (#9650) --- .../tx/columnshard/blobs_action/transaction/tx_write.cpp | 8 +++++--- ydb/core/tx/columnshard/operations/manager.h | 4 ++++ ydb/core/tx/columnshard/transactions/locks/interaction.h | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp b/ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp index 579a2e5eaa14..48d94c41fd03 100644 --- a/ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp +++ b/ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp @@ -151,9 +151,11 @@ void TTxWrite::Complete(const TActorContext& ctx) { if (!writeMeta.HasLongTxId()) { auto op = Self->GetOperationsManager().GetOperationVerified((TOperationWriteId)writeMeta.GetWriteId()); if (op->GetBehaviour() == EOperationBehaviour::WriteWithLock || op->GetBehaviour() == EOperationBehaviour::NoTxWrite) { - auto evWrite = std::make_shared(writeMeta.GetTableId(), - buffer.GetAggregations()[i]->GetRecordBatch(), Self->GetIndexOptional()->GetVersionedIndex().GetPrimaryKey()); - Self->GetOperationsManager().AddEventForLock(*Self, op->GetLockId(), evWrite); + if (op->GetBehaviour() != EOperationBehaviour::NoTxWrite || Self->GetOperationsManager().HasReadLocks(writeMeta.GetTableId())) { + auto evWrite = std::make_shared(writeMeta.GetTableId(), + buffer.GetAggregations()[i]->GetRecordBatch(), Self->GetIndexOptional()->GetVersionedIndex().GetPrimaryKey()); + Self->GetOperationsManager().AddEventForLock(*Self, op->GetLockId(), evWrite); + } } if (op->GetBehaviour() == EOperationBehaviour::NoTxWrite) { Self->OperationsManager->AddTemporaryTxLink(op->GetLockId()); diff --git a/ydb/core/tx/columnshard/operations/manager.h b/ydb/core/tx/columnshard/operations/manager.h index 9e2651e24da0..7912df4f968c 100644 --- a/ydb/core/tx/columnshard/operations/manager.h +++ b/ydb/core/tx/columnshard/operations/manager.h @@ -208,6 +208,10 @@ class TOperationsManager { } } + bool HasReadLocks(const ui64 pathId) const { + return InteractionsContext.HasReadIntervals(pathId); + } + TOperationsManager(); private: diff --git a/ydb/core/tx/columnshard/transactions/locks/interaction.h b/ydb/core/tx/columnshard/transactions/locks/interaction.h index abd9ef92f6d5..80e453bc2bb8 100644 --- a/ydb/core/tx/columnshard/transactions/locks/interaction.h +++ b/ydb/core/tx/columnshard/transactions/locks/interaction.h @@ -400,6 +400,10 @@ class TInteractionsContext { THashMap ReadIntervalsByPathId; public: + bool HasReadIntervals(const ui64 pathId) const { + return ReadIntervalsByPathId.contains(pathId); + } + NJson::TJsonValue DebugJson() const { NJson::TJsonValue result = NJson::JSON_MAP; for (auto&& i : ReadIntervalsByPathId) {