Skip to content

Conversation

dranikpg
Copy link
Contributor

Fixes the long hunted blpop bug

@dranikpg dranikpg requested a review from romange June 18, 2023 15:00
Comment on lines 393 to 394
bool keep = trans->RunInShard(this, true);
DLOG_IF(INFO, !dbg_id.empty()) << "Eager run " << sid << ", " << dbg_id << ", keep " << keep;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should add there a DCHECK_EQ(trans->GetTxqPos(shard) != TxQueue::kEnd, keep)? Requires adding GetTxqPos

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Signed-off-by: Vladislav Oleshko <[email protected]>
@@ -390,7 +390,7 @@ void EngineShard::PollExecution(const char* context, Transaction* trans) {
}
++stats_.ooo_runs;

bool keep = trans->RunInShard(this);
bool keep = trans->RunInShard(this, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should_run is also set for SUSPENDED_Q.
Why not be more precise and pass trans_mask & Transaction::OUT_OF_ORDER ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, to avoid the situation where both bits are set, I suggest to add

 sd.local_mask |= SUSPENDED_Q;
sd.local_mask &= ~OUT_OF_ORDER;  /

in WatchInShard

Copy link
Contributor Author

@dranikpg dranikpg Jun 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True... I have actually a parallel PR where I remove the unwatch hop and make all wakeups single hop 🙄

But generally running blocked ooo should be safe because they have they run directly in PollExecution and should have only one hop after wakeups 🤔

Copy link
Collaborator

@romange romange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

Gave some comments.

Signed-off-by: Vladislav Oleshko <[email protected]>
@@ -243,6 +245,10 @@ class Transaction {
return shard_data_[SidToId(sid)].local_mask;
}

uint32_t GetLocalTxqPos(ShardId sid) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you do not need it. There is PqPos for that. Remove either of them.

@romange romange merged commit 6d4d740 into dragonflydb:main Jun 18, 2023
@dranikpg dranikpg deleted the fix-tx-ooo branch June 20, 2023 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants