swuferhong opened a new issue, #3555:
URL: https://github.com/apache/fluss/issues/3555

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/fluss/issues) and 
found nothing similar.
   
   
   ### Description
   
   ### Problem
   
   For leader-only rebalance, the coordinator is expected to execute leader 
migrations sequentially: the next task should not start until the current 
target leader has applied `NotifyLeaderAndIsr`.
   
   However, the current completion check can finish a leader-only rebalance 
task too early. `NotifyLeaderAndIsr` is sent to multiple replicas, and the 
coordinator may complete the task after receiving a successful response from a 
replica that is not the new leader, as long as the ZooKeeper leader has already 
changed to the target leader.
   
   This means the rebalance task can be marked completed before the new leader 
has acknowledged the request. For KV tables, this is risky because the 
leader-side KV state may not be ready yet.
   
   ### Expected Behavior
   
   For leader-only rebalance, a task should only be completed when:
   
   - the `NotifyLeaderAndIsr` result for the bucket succeeded
   - the response comes from the target new leader
   - the current leader is the target new leader
   
   In other words, completion should require `result.succeeded()` and 
`responseServerId == newLeader`.
   
   ### Root Cause
   
   The leader-only rebalance completion path only checked whether the current 
leader matched the target leader. It did not consider which tablet server 
returned the `NotifyLeaderAndIsr` response, nor whether the bucket-level result 
succeeded.
   
   
   ### Willingness to contribute
   
   - [ ] I'm willing to submit a PR!


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to