fix(transaction): Replace with armed sync point (#2708)

1. Replaces run_barrier as a synchronization point with is_armed + an embedded blocking counter for awaiting running jobs
2. Replaces IsArmedInShard + GetLocalMask + is_armed.exchange chain with a single DisarmInShard() / DisarmInShardWhen

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
Vladislav 2024-03-14 17:40:32 +03:00 committed by GitHub
parent 7e0536fd4c
commit 9c6e6a96b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 103 additions and 128 deletions

View file

@ -123,7 +123,7 @@ void BlockingController::FinalizeWatched(ArgSlice args, Transaction* tx) {
VLOG(1) << "FinalizeBlocking [" << owner_->shard_id() << "]" << tx->DebugId();
bool removed = awakened_transactions_.erase(tx);
DCHECK(!removed || (tx->GetLocalMask(owner_->shard_id()) & Transaction::AWAKED_Q));
DCHECK(!removed || (tx->DEBUG_GetLocalMask(owner_->shard_id()) & Transaction::AWAKED_Q));
auto dbit = watched_dbs_.find(tx->GetDbIndex());
@ -138,7 +138,7 @@ void BlockingController::FinalizeWatched(ArgSlice args, Transaction* tx) {
for (string_view key : args) {
bool removed_awakened = wt.UnwatchTx(key, tx);
CHECK(!removed_awakened || removed)
<< tx->DebugId() << " " << key << " " << tx->GetLocalMask(owner_->shard_id());
<< tx->DebugId() << " " << key << " " << tx->DEBUG_GetLocalMask(owner_->shard_id());
}
if (wt.queue_map.empty()) {