Skip to content

Conversation

@RaidenE1
Copy link
Contributor

@RaidenE1 RaidenE1 commented Nov 27, 2025

In #20755 we introduce a initial
rebalance delay for streams group, now we would like to expand it to all
rebalance when group is empty to avoid frequent rebalance in a small
time period

Reviewers: Lucas Brutschy lbrutschy@confluent.io

@github-actions github-actions bot added triage PRs from the community group-coordinator small Small PRs labels Nov 27, 2025
@lucasbru lucasbru requested a review from Copilot November 28, 2025 12:26
@lucasbru lucasbru self-assigned this Nov 28, 2025
Copilot finished reviewing on behalf of lucasbru November 28, 2025 12:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the rebalance delay mechanism from only applying to initial group creation (epoch 0) to applying whenever a group becomes empty, regardless of the group's epoch. This helps avoid frequent rebalances when members repeatedly leave and rejoin an empty group in a short time period.

Key Changes

  • The rebalance delay now triggers for any empty group (not just epoch 0)
  • Assignment epoch handling during delay periods supports groups with non-zero epochs
  • Test coverage ensures the existing test doesn't interfere with the new delay behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java Changed rebalance delay condition from groupEpoch() == 0 to isEmpty(), removed assignment epoch check during delay, and updated target assignment epoch calculation to use Math.max(1, group.assignmentEpoch()) to support groups that became empty after having assignments
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java Added test for rebalance delay when joining empty group with non-zero epoch, and disabled delay for existing test that wasn't designed to handle it

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lucasbru lucasbru merged commit 65a3bd2 into apache:trunk Nov 28, 2025
31 of 32 checks passed
@github-actions github-actions bot removed the triage PRs from the community label Nov 29, 2025
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.

2 participants