[server] Require new leader ack for leader-only rebalance#3556
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the completion criteria for leader-only rebalance in the coordinator so that a rebalance task is only marked complete after the target new leader has successfully acknowledged NotifyLeaderAndIsr, preventing premature completion when other replicas respond first (Issue #3555).
Changes:
- Pass
NotifyLeaderAndIsrper-bucket result +responseServerIdinto rebalance completion checks. - Require leader-only rebalance completion to be gated by:
result.succeeded(), response fromnewLeader, andcurrentLeader == newLeader. - Add/extend coordinator tests to verify leader-only rebalance waits for the new leader’s successful response.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| fluss-server/src/main/java/org/apache/fluss/server/coordinator/CoordinatorEventProcessor.java | Tightens leader-only rebalance completion conditions using the responding server id and per-bucket success, and avoids completing leader-only rebalance from leader/isr-change events. |
| fluss-server/src/test/java/org/apache/fluss/server/coordinator/CoordinatorEventProcessorTest.java | Adds targeted tests to ensure leader-only rebalance doesn’t complete on successful responses from non-target replicas and validates the new completion predicate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1c56948 to
186959a
Compare
Contributor
Author
|
@wuchong copilot's comments addressed. PTAL, thanks. |
wuchong
approved these changes
Jul 9, 2026
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.
Purpose
Linked issue: close #3555
Leader-only rebalance previously completed once the current leader matched
the target leader after any
NotifyLeaderAndIsrresponse for the bucket. SinceNotifyLeaderAndIsris sent to multiple replicas, this could complete the taskbefore the new leader acknowledged the request.
Pass the bucket result and response server id into the completion check, and
only complete leader-only rebalance when the result succeeded and the response
came from the target new leader. Keep LeaderAndIsr change handling from
directly completing leader-only rebalance tasks.
Brief change log
Tests
API and Format
Documentation