mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix: call NotifyPending only from tx queue invocations (#1439)
* fix: call NotifyPending only from tx queue invocations --------- Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
parent
f25098bb98
commit
6f78ae5073
5 changed files with 61 additions and 11 deletions
|
@ -522,16 +522,24 @@ bool Transaction::RunInShard(EngineShard* shard, bool txq_ooo) {
|
|||
sd.local_mask &= ~OUT_OF_ORDER;
|
||||
}
|
||||
|
||||
// This is the last hop, so clear cont_trans if its held by the current tx
|
||||
shard->RemoveContTx(this);
|
||||
|
||||
// It has 2 responsibilities.
|
||||
// 1: to go over potential wakened keys, verify them and activate watch queues.
|
||||
// 2: if this transaction was notified and finished running - to remove it from the head
|
||||
// of the queue and notify the next one.
|
||||
// RunStep is also called for global transactions because of commands like MOVE.
|
||||
if (shard->blocking_controller()) {
|
||||
if (auto* bcontroller = shard->blocking_controller(); bcontroller) {
|
||||
if (awaked_prerun || was_suspended) {
|
||||
shard->blocking_controller()->FinalizeWatched(largs, this);
|
||||
bcontroller->FinalizeWatched(largs, this);
|
||||
}
|
||||
|
||||
// Wake only if no tx queue head is currently running
|
||||
// Note: RemoveContTx might have no effect above if this tx had no continuations
|
||||
if (shard->GetContTx() == nullptr) {
|
||||
bcontroller->NotifyPending();
|
||||
}
|
||||
shard->blocking_controller()->NotifyPending();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1232,12 +1240,12 @@ void Transaction::UnlockMultiShardCb(const std::vector<KeyList>& sharded_keys, E
|
|||
sd.pq_pos = TxQueue::kEnd;
|
||||
}
|
||||
|
||||
shard->ShutdownMulti(this);
|
||||
shard->RemoveContTx(this);
|
||||
|
||||
// notify awakened transactions, not sure we need it here because it's done after
|
||||
// each operation
|
||||
if (shard->blocking_controller())
|
||||
// Wake only if no tx queue head is currently running
|
||||
if (shard->blocking_controller() && shard->GetContTx() == nullptr)
|
||||
shard->blocking_controller()->NotifyPending();
|
||||
|
||||
shard->PollExecution("unlockmulti", nullptr);
|
||||
|
||||
this->DecreaseRunCnt();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue