-
Notifications
You must be signed in to change notification settings - Fork 957
Consolidate various BLOCKED_WAIT* states #562
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
Conversation
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #562 +/- ##
============================================
- Coverage 70.22% 70.04% -0.19%
============================================
Files 109 109
Lines 59956 59955 -1
============================================
- Hits 42104 41993 -111
- Misses 17852 17962 +110
|
|
Nice. Please add some useful text in the description, rather than just a link to the issue. We always ask that from contributors. It's helpful when reviewing, it's used as commit message when merging and it's good for reference later, even if the PR is not material for release notes. |
|
Will do |
zuiderkwast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good cleanup. The PR description helped me a lot! Thanks.
If you decide to take my suggestions, don't forget to add signoff.
I feel that comparing to the cmd structure point is cleaner/more readable but yes it is very subjective. |
Pros and cons. It's perhaps cleaner, but it's more important IMO to be consistent with other code doing the same thing. (The alternative is to change all the existing command comparisons to your style.) Avoiding the need to initialize and store these extra pointers is another point. |
You got me on "consistency" :-). I will switch to |
zuiderkwast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but there's some crash in test "XREAD: XADD + DEL + LPUSH should not awake client".
This reverts commit 949d017. Signed-off-by: Ping Xie <[email protected]>
|
This is not a crash but a behavior change caught by the test. The unification of the three blocked types,, incorrectly, allows an LPUSH operation to wake up a stream reader. On a closer look, I don't think there is an easy way to unify these 3 states, for two reasons:
I reverted the last commit. |
There are currently three block types: BLOCKED_WAIT, BLOCKED_WAITAOF, and BLOCKED_WAIT_PREREPL, used to block clients executing `WAIT`, `WAITAOF`, and `CLUSTER SETSLOT`, respectively. They share the same workflow: the client is blocked until replication to the expected number of replicas completes. However, they provide different responses depending on the commands involved. Using distinct block types leads to code duplication and reduced readability. This PR consolidates the three types into a single WAIT type, differentiating them using the pending command to ensure the appropriate response is returned. Fix valkey-io#427 --------- Signed-off-by: Ping Xie <[email protected]>
BLOCKED_WAITAOF was consolidated into BLOCKED_WAIT in valkey-io#562. Signed-off-by: Binbin <[email protected]>
BLOCKED_WAITAOF was consolidated into BLOCKED_WAIT in #562. Signed-off-by: Binbin <[email protected]>
There are currently three block types: BLOCKED_WAIT, BLOCKED_WAITAOF, and BLOCKED_WAIT_PREREPL, used to block clients executing
WAIT,WAITAOF, andCLUSTER SETSLOT, respectively. They share the same workflow: the client is blocked until replication to the expected number of replicas completes. However, they provide different responses depending on the commands involved. Using distinct block types leads to code duplication and reduced readability. This PR consolidates the three types into a single WAIT type, differentiating them using the pending command to ensure the appropriate response is returned.Fix #427