KAFKA-20268: Initialize group epochs to 1 for assignment offload#21700
Merged
dajac merged 5 commits intoapache:trunkfrom Mar 11, 2026
Merged
KAFKA-20268: Initialize group epochs to 1 for assignment offload#21700dajac merged 5 commits intoapache:trunkfrom
dajac merged 5 commits intoapache:trunkfrom
Conversation
Once assignment offload is implemented, newly created groups may not have their first assignment at epoch 1 available yet. We cannot give the member an epoch of 0, since it is reserved for new members joining a group. The new member's epoch must be greater than 0 and less than the group epoch. To resolve this, we initialize groups at epoch 1 with target assignment epoch 1. Epoch 1 contains an empty assignment and the first computed assignment will have epoch 2. Members joining a new group will reconcile towards epoch 1 while waiting for epoch 2's assignment. Streams groups already start group epochs at 2. We update streams groups to use the same approach as consumer and share groups.
dajac
reviewed
Mar 10, 2026
Member
dajac
left a comment
There was a problem hiding this comment.
@squah-confluent Thanks for the PR. I left a few minor comments.
Comment on lines
43
to
44
| this.assignmentEpoch = 1; | ||
| this.assignmentTimestamp = 0L; |
Member
There was a problem hiding this comment.
Should we use TargetAssignmentMetadata.INITIAL to init those two?
Contributor
Author
There was a problem hiding this comment.
That's a good idea, yes.
Comment on lines
42
to
43
| this.assignmentEpoch = 1; | ||
| this.assignmentTimestamp = 0L; |
Comment on lines
45
to
46
| this.targetAssignmentEpoch = 1; | ||
| this.targetAssignmentTimestamp = 0L; |
Comment on lines
-22614
to
-22618
| // The group epoch is bumped. | ||
| GroupCoordinatorRecordHelpers.newConsumerGroupEpochRecord(groupId, 1, 0), | ||
| // The target assignment is created. | ||
| GroupCoordinatorRecordHelpers.newConsumerGroupTargetAssignmentRecord(groupId, memberId1, Map.of()), | ||
| GroupCoordinatorRecordHelpers.newConsumerGroupTargetAssignmentMetadataRecord(groupId, 1, context.time.milliseconds()), |
Member
There was a problem hiding this comment.
Let's replace those with a comment explaining why there are not here.
Contributor
Author
There was a problem hiding this comment.
Added a comment
…epoch and timestamp in group builders
…ItBeforeResolutionCompleted
Member
|
@squah-confluent Could you check the failed tests? They seem to be related. |
lucasbru
approved these changes
Mar 11, 2026
Member
lucasbru
left a comment
There was a problem hiding this comment.
This is a nice improvement, cleaner than the previous logic. Thanks, LGTM!
Contributor
Author
|
CI on trunk is broken again. I opened a fix at #21707. |
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.
Once assignment offload is implemented, newly created groups may not
have their first assignment at epoch 1 available yet. We cannot give the
member an epoch of 0, since it is reserved for new members joining a
group. The new member's epoch must be greater than 0 and less than the
group epoch.
To resolve this, we initialize groups at epoch 1 with target assignment
epoch 1. Epoch 1 contains an empty assignment and the first computed
assignment will have epoch 2. Members joining a new group will reconcile
towards epoch 1 while waiting for epoch 2's assignment.
Streams groups already start group epochs at 2. We update streams groups
to use the same approach as consumer and share groups.
Reviewers: Lucas Brutschy lbrutschy@confluent.io, David Jacot
djacot@confluent.io