Skip to content

Commit

Permalink
remove useless locks broking checker (#9650)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored Sep 23, 2024
1 parent e2d1d75 commit 1002b94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<NOlap::NTxInteractions::TEvWriteWriter>(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<NOlap::NTxInteractions::TEvWriteWriter>(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());
Expand Down
4 changes: 4 additions & 0 deletions ydb/core/tx/columnshard/operations/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ class TOperationsManager {
}
}

bool HasReadLocks(const ui64 pathId) const {
return InteractionsContext.HasReadIntervals(pathId);
}

TOperationsManager();

private:
Expand Down
4 changes: 4 additions & 0 deletions ydb/core/tx/columnshard/transactions/locks/interaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ class TInteractionsContext {
THashMap<ui64, TReadIntervals> 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) {
Expand Down

0 comments on commit 1002b94

Please sign in to comment.