KAFKA-16531: calculate check-quorum when leader is not in voter set#16211
Merged
showuon merged 6 commits intoapache:trunkfrom Jun 21, 2024
Merged
KAFKA-16531: calculate check-quorum when leader is not in voter set#16211showuon merged 6 commits intoapache:trunkfrom
showuon merged 6 commits intoapache:trunkfrom
Conversation
chia7712
reviewed
Jun 6, 2024
| // The majority number of the voters excluding the leader. Ex: 3 voters, the value will be 1 | ||
| int majority = voterStates.size() / 2; | ||
| // The majority number of the voters. Ex: 3 voters, the value will be 2 | ||
| int majority = (int) ((double) (voterStates.size() + 1) / 2); |
Member
There was a problem hiding this comment.
just curios. this function will return majority number 2 if there are 4 voters. Is that expected? I assume the corrected number is 3
Member
Author
There was a problem hiding this comment.
Ah, good catch! My test didn't work as expected. Also updated the test to catch the issue. Thanks.
Member
Author
Member
|
@showuon can you update the description? |
Member
Author
PR description updated. Thanks. |
Member
|
@showuon could you please fix the build error? |
jsancio
reviewed
Jun 14, 2024
Member
Author
|
Failed tests are unrelated |
TaiJuWu
pushed a commit
to TaiJuWu/kafka
that referenced
this pull request
Jul 4, 2024
…pache#16211) In the check-quorum calculation, the leader should not assume that it is part of the voter set. This may happen when the leader is removing itself from the voter set. This PR improves it by checking if leader is in the voter set or not, and decide how many follower fetches required. Also add tests. Co-authored-by: Colin P. McCabe <cmccabe@apache.org> Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, José Armando García Sancio <jsancio@apache.org>
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.
In the check-quorum calculation, the leader should not assume that it is part of the voter set. This may happen when the leader is removing itself from the voter set. This PR improves it by checking if leader is in the voter set or not, and decide how many follower fetches required. Also add tests.
Committer Checklist (excluded from commit message)