Skip to content

KAFKA-20442: Update streams group assignment epoch when last member leaves#22047

Merged
dajac merged 3 commits intoapache:trunkfrom
dajac:KAFKA-20442-streams
Apr 15, 2026
Merged

KAFKA-20442: Update streams group assignment epoch when last member leaves#22047
dajac merged 3 commits intoapache:trunkfrom
dajac:KAFKA-20442-streams

Conversation

@dajac
Copy link
Copy Markdown
Member

@dajac dajac commented Apr 14, 2026

When the last member of a streams group is fenced, the group epoch is
bumped but the assignment epoch is not updated. This leaves the empty
group with groupEpoch > assignmentEpoch, violating the invariant that
an empty group should have matching epochs. This patch writes a
StreamsGroupTargetAssignmentMetadataRecord when the fence operation
results in an empty group so that the assignment epoch catches up to the
group epoch.

Reviewers: Lucas Brutschy lbrutschy@confluent.io, Sean Quah
squah@confluent.io

…eaves

When the last member of a streams group is fenced, the group epoch is
bumped but the assignment epoch is not updated. This leaves the empty
group with `groupEpoch > assignmentEpoch`, violating the invariant
that an empty group should have matching epochs. This patch writes a
`StreamsGroupTargetAssignmentMetadataRecord` when the fence operation
results in an empty group so that the assignment epoch catches up to
the group epoch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use a timestamp of zero in the target assignment metadata record to
mimic the behavior of a new group. This avoids the assignment
interval check delaying the next assignment computation when a new
member joins shortly after the group becomes empty.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@lucasbru lucasbru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Copy Markdown
Contributor

@squah-confluent squah-confluent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

The test changes don't make sense given the change to fencing.

@lucasbru
Copy link
Copy Markdown
Member

Thanks for the PR!

The test changes don't make sense given the change to fencing.

the change includes regular leaving as well, or what do you mean?

Copy link
Copy Markdown
Contributor

@squah-confluent squah-confluent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasbru This is what I meant

Revert incorrect change in a non-fence test and use zero timestamp
in the session timeout test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dajac dajac requested a review from squah-confluent April 14, 2026 14:46
@dajac dajac merged commit e08a150 into apache:trunk Apr 15, 2026
22 checks passed
@dajac dajac deleted the KAFKA-20442-streams branch April 15, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants