Skip to content

Commit

Permalink
fix incorrect data validation and correction in case WO/RO Txs
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 committed Jan 7, 2025
1 parent 2876ba4 commit aaf6aae
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions ydb/core/tx/columnshard/columnshard__write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,20 +313,22 @@ class TCommitOperation {
auto& lock = evWrite.Record.GetLocks().GetLocks()[0];
SendingShards = std::set<ui64>(locks.GetSendingShards().begin(), locks.GetSendingShards().end());
ReceivingShards = std::set<ui64>(locks.GetReceivingShards().begin(), locks.GetReceivingShards().end());
if (!ReceivingShards.size() || !SendingShards.size()) {
ReceivingShards.clear();
SendingShards.clear();
} else if (!locks.HasArbiterColumnShard()) {
ArbiterColumnShard = *ReceivingShards.begin();
if (!ReceivingShards.contains(TabletId) && !SendingShards.contains(TabletId)) {
return TConclusionStatus::Fail("shard is incorrect for sending/receiving lists");
if (ReceivingShards.size()) {
AFL_VERIFY(SendingShards.size());
if (!locks.HasArbiterColumnShard()) {
ArbiterColumnShard = *ReceivingShards.begin();
if (!ReceivingShards.contains(TabletId) && !SendingShards.contains(TabletId)) {
return TConclusionStatus::Fail("shard is incorrect for sending/receiving lists");
}
} else {
ArbiterColumnShard = locks.GetArbiterColumnShard();
AFL_VERIFY(ArbiterColumnShard);
if (!ReceivingShards.contains(TabletId) && !SendingShards.contains(TabletId)) {
return TConclusionStatus::Fail("shard is incorrect for sending/receiving lists");
}
}
} else {
ArbiterColumnShard = locks.GetArbiterColumnShard();
AFL_VERIFY(ArbiterColumnShard);
if (!ReceivingShards.contains(TabletId) && !SendingShards.contains(TabletId)) {
return TConclusionStatus::Fail("shard is incorrect for sending/receiving lists");
}
AFL_VERIFY(!SendingShards.size());
}

TxId = evWrite.Record.GetTxId();
Expand Down

0 comments on commit aaf6aae

Please sign in to comment.