You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "swuferhong (via GitHub)" <gi...@apache.org> on 2026/04/14 05:57:50 UTC
[PR] [server] Make leader-only rebalance tasks execute sequentially [fluss]
swuferhong opened a new pull request, #3071:
URL: https://github.com/apache/fluss/pull/3071
<!--
*Thank you very much for contributing to Fluss - we are happy that you want to help us improve Fluss. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
## Contribution Checklist
- Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/fluss/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no issue.
- Name the pull request in the format "[component] Title of the pull request", where *[component]* should be replaced by the name of the component being changed. Typically, this corresponds to the component label assigned to the issue (e.g., [kv], [log], [client], [flink]). Skip *[component]* if you are unsure about which is the best component.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes.
- Each pull request should address only one issue, not mix up code from multiple issues.
- **Generative AI disclosure:** Indicate whether generative AI tools were used in authoring this PR. If yes, specify the tool below.
- [ ] No generative AI tools used
- [ ] Yes (please specify the tool below)
**(The sections below can be removed for hotfixes or typos)**
-->
<!--
Generated-by: [Tool Name and Version] following [the guidelines](https://github.com/apache/fluss/blob/main/AGENTS.md)
-->
### Purpose
<!-- Linking this pull request to the issue -->
Linked issue: #3070
<!-- What is the purpose of the change -->
Previously, leader-only rebalance tasks (where only the leader changes
but the replica set stays the same) were completed immediately after
triggering the leader election, without waiting for the TabletServer
to acknowledge the change. This caused all leader migrations to fire
simultaneously, putting excessive pressure on tablet servers, especially
for KV tables.
This patch removes the immediate `finishRebalanceTask()` call for
leader-only changes and instead completes the task in
`processNotifyLeaderAndIsrResponseReceivedEvent()` when the TabletServer
responds. This ensures leader migrations execute one at a time, matching
the behavior of replica migration tasks.
Also fixes `TestTabletServerGateway` to return per-bucket success results
in `NotifyLeaderAndIsr` responses, which is necessary for the coordinator
to identify acknowledged buckets in the response callback.
### Brief change log
<!-- Please describe the changes made in this pull request and explain how they address the issue -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Make leader-only rebalance tasks execute sequentially [fluss]
Posted by "swuferhong (via GitHub)" <gi...@apache.org>.
swuferhong commented on code in PR #3071:
URL: https://github.com/apache/fluss/pull/3071#discussion_r3093703729
##########
fluss-server/src/main/java/org/apache/fluss/server/coordinator/CoordinatorEventProcessor.java:
##########
@@ -980,6 +980,14 @@ private void processNotifyLeaderAndIsrResponseReceivedEvent(
// trigger replicas to offline
onReplicaBecomeOffline(offlineReplicas);
}
+
+ // Try to complete rebalance tasks for the buckets in the response.
+ // This is essential for leader-only migrations to ensure they wait for the tablet
+ // server to acknowledge the leader change before proceeding to the next migration.
+ for (NotifyLeaderAndIsrResultForBucket notifyLeaderAndIsrResultForBucket :
+ notifyLeaderAndIsrResultForBuckets) {
+ tryToCompleteRebalanceTask(notifyLeaderAndIsrResultForBucket.getTableBucket());
Review Comment:
Thinks @LiebingYu. This problem will be trace by this issue: https://github.com/apache/fluss/issues/3096
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Make leader-only rebalance tasks execute sequentially [fluss]
Posted by "LiebingYu (via GitHub)" <gi...@apache.org>.
LiebingYu commented on code in PR #3071:
URL: https://github.com/apache/fluss/pull/3071#discussion_r3079437440
##########
fluss-server/src/main/java/org/apache/fluss/server/coordinator/CoordinatorEventProcessor.java:
##########
@@ -980,6 +980,14 @@ private void processNotifyLeaderAndIsrResponseReceivedEvent(
// trigger replicas to offline
onReplicaBecomeOffline(offlineReplicas);
}
+
+ // Try to complete rebalance tasks for the buckets in the response.
+ // This is essential for leader-only migrations to ensure they wait for the tablet
+ // server to acknowledge the leader change before proceeding to the next migration.
+ for (NotifyLeaderAndIsrResultForBucket notifyLeaderAndIsrResultForBucket :
+ notifyLeaderAndIsrResultForBuckets) {
+ tryToCompleteRebalanceTask(notifyLeaderAndIsrResultForBucket.getTableBucket());
Review Comment:
After switching to sequential leader transfer one bucket at a time, a new issue arises: if the leader transfer fails for any single bucket, it may block all subsequent leader transfers. However, I understand it is acceptable to not address this issue for now, but users must manually handle such blocking situations.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Make leader-only rebalance tasks execute sequentially [fluss]
Posted by "swuferhong (via GitHub)" <gi...@apache.org>.
swuferhong merged PR #3071:
URL: https://github.com/apache/fluss/pull/3071
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Make leader-only rebalance tasks execute sequentially [fluss]
Posted by "LiebingYu (via GitHub)" <gi...@apache.org>.
LiebingYu commented on code in PR #3071:
URL: https://github.com/apache/fluss/pull/3071#discussion_r3079437440
##########
fluss-server/src/main/java/org/apache/fluss/server/coordinator/CoordinatorEventProcessor.java:
##########
@@ -980,6 +980,14 @@ private void processNotifyLeaderAndIsrResponseReceivedEvent(
// trigger replicas to offline
onReplicaBecomeOffline(offlineReplicas);
}
+
+ // Try to complete rebalance tasks for the buckets in the response.
+ // This is essential for leader-only migrations to ensure they wait for the tablet
+ // server to acknowledge the leader change before proceeding to the next migration.
+ for (NotifyLeaderAndIsrResultForBucket notifyLeaderAndIsrResultForBucket :
+ notifyLeaderAndIsrResultForBuckets) {
+ tryToCompleteRebalanceTask(notifyLeaderAndIsrResultForBucket.getTableBucket());
Review Comment:
After switching to sequential leader transfer one bucket at a time, a new issue arises: if the leader transfer fails for any single bucket, it may block all subsequent leader transfers. However, I understand it is acceptable to not address this issue for now, but users must manually handle such blocking situations. WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org