Fix WAITAOF reply when using last_offset and last_numreplicas#11917
Merged
oranagra merged 7 commits intoredis:unstablefrom Mar 15, 2023
Merged
Fix WAITAOF reply when using last_offset and last_numreplicas#11917oranagra merged 7 commits intoredis:unstablefrom
oranagra merged 7 commits intoredis:unstablefrom
Conversation
WAITAOF wad added in redis#11713, its return is an array. But forget to handle WAITAOF in last_offset and last_numreplicas, causing WAITAOF to return a WAIT like reply. Tests was added to validate that case (both WAIT and WAITAOF).
Contributor
Author
|
the WAIT test case, i will add it later found it by reviewing the code. edit: It seems that there is a problem, can WAIT and WAITAOF mix re-use like this? |
oranagra
reviewed
Mar 15, 2023
Member
oranagra
left a comment
There was a problem hiding this comment.
thanks for catching my bug in review!!!
enjoy-binbin
commented
Mar 15, 2023
oranagra
reviewed
Mar 15, 2023
oranagra
approved these changes
Mar 15, 2023
enjoy-binbin
added a commit
to enjoy-binbin/redis
that referenced
this pull request
Mar 15, 2023
There be a situation that satisfies WAIT, and then wrongly unblock WAITAOF because we mix-use last_offset and last_numreplicas. We update last_offset and last_numreplicas only when the condition matches. i.e. output of either replicationCountAOFAcksByOffset or replicationCountAcksByOffset is right. In this case, we need to have separate last_ variables for each of them. Added a last_aof_offset and last_aof_numreplicas for WAITAOF. WAITAOF was added in redis#11713. Found while coding redis#11917. A Test was added to validate that case.
oranagra
pushed a commit
that referenced
this pull request
Mar 15, 2023
There be a situation that satisfies WAIT, and then wrongly unblock WAITAOF because we mix-use last_offset and last_numreplicas. We update last_offset and last_numreplicas only when the condition matches. i.e. output of either replicationCountAOFAcksByOffset or replicationCountAcksByOffset is right. In this case, we need to have separate last_ variables for each of them. Added a last_aof_offset and last_aof_numreplicas for WAITAOF. WAITAOF was added in #11713. Found while coding #11917. A Test was added to validate that case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WAITAOF wad added in #11713, its return is an array.
But forget to handle WAITAOF in last_offset and last_numreplicas,
causing WAITAOF to return a WAIT like reply.
Tests was added to validate that case (both WAIT and WAITAOF).
This PR also refactored processClientsWaitingReplicas a bit for better
maintainability and readability.