Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove blpop FindFirst hop after wakeup #1168

Merged
merged 4 commits into from
May 3, 2023

Conversation

dranikpg
Copy link
Contributor

@dranikpg dranikpg commented May 1, 2023

Solves #1153

Adds the following changes:

  • NotifySuspended runs only once and stores the wakeup key in the tx shard's data
  • BLPOP after waking up doesn't run FindFirst and takes the key directly from the wakeup args

Signed-off-by: Vladislav Oleshko <[email protected]>
@dranikpg dranikpg marked this pull request as ready for review May 1, 2023 09:39
@dranikpg dranikpg requested a review from romange May 1, 2023 09:39
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.

Can you also verify with ruby/sidekick test from our playground repo that everything is working well and nothing deadlocks/crashes?

// We don't care about preserving the strict order with multiple operations running on blocking
// keys in parallel, because the internal order is not observable from outside either way.
uint64_t default_txid = UINT64_MAX;
if (!notify_txid_.compare_exchange_weak(default_txid, committed_txid, memory_order_relaxed))
Copy link
Collaborator

Choose a reason for hiding this comment

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

compare_exchange_weak is an overkill for "run-once" semantics.
Also, I wonder if notify_txid_ is needed after this change or it's been used only here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I forgot to simplify FindFirst.

compare_exchange_weak is an overkill for "run-once" semantics.

How else should I do run-once? 👀

Copy link
Collaborator

Choose a reason for hiding this comment

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

for example,

if (var.fetch_add(1, relaxed) == 0) {

}

dranikpg added 3 commits May 1, 2023 14:41
Signed-off-by: Vladislav Oleshko <[email protected]>
Signed-off-by: Vladislav Oleshko <[email protected]>
Signed-off-by: Vladislav Oleshko <[email protected]>
@dranikpg
Copy link
Contributor Author

dranikpg commented May 2, 2023

I checked the ruby playground and it seems to work (worker rb + loadtest)

@dranikpg dranikpg requested a review from romange May 2, 2023 10:34
@dranikpg dranikpg merged commit cb82680 into dragonflydb:main May 3, 2023
@dranikpg dranikpg deleted the simplify-blpop branch May 28, 2023 09:17
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