Merged
Conversation
…ngle round of rebalance (apache#13550) KAFKA-14639: A single partition may be revoked and assign during a single round of rebalance (apache#13550) This is a really long story, but the incident started in KAFKA-13419 when we observed a member sending out a topic partition owned from the previous generation when a member missed a rebalance cycle due to REBALANCE_IN_PROGRESS. This patch changes the AbstractStickyAssignor.AllSubscriptionsEqual method. In short, it should no long check and validate only the highest generation. Instead, we consider 3 cases: 1. Member will continue to hold on to its partition if there are no other owners 2. If there are 1+ owners to the same partition. One with the highest generation will win. 3. If two members of the same generation hold on to the same partition. We will log an error but remove both from the assignment. (Same with the current logic) Here are some important notes that lead to the patch: - If a member is kicked out of the group, and `UNKNOWN_MEMBER_ID` will be thrown. - It seems to be a common situation that members are late to joinGroup and therefore get `REBALANCE_IN_PROGRESS` error. This is why we don't want to reset generation because it might cause lots of revocations and can be disruptive To summarize the current behavior of different errors: `REBALANCE_IN_PROGRESS` - heartbeat: requestRejoin if member state is stable - joinGroup: rejoin immediately - syncGroup: rejoin immediately - commit: requestRejoin and fail the commit. Raise this exception if the generation is staled, i.e. another rebalance is already in progress. `UNKNOWN_MEMBER_ID` - heartbeat: resetStateAndRejoinif generation hasn't changed. otherwise, ignore - joinGroup: resetStateAndRejoin if generation unchanged, otherwise rejoin immediately - syncGroup: resetStateAndRejoin if generation unchanged, otherwise rejoin immediately `ILLEGAL_GENERATION` - heartbeat: resetStateAndRejoinif generation hasn't changed. otherwise, ignore - syncGroup: raised the exception if generation has been resetted or the member hasn't completed rebalancing. then resetStateAndRejoin if generation unchanged, otherwise rejoin immediately Reviewers: David Jacot <djacot@confluent.io>
5970724 to
ef06583
Compare
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.
More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.
Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.
Committer Checklist (excluded from commit message)