Repository navigation
[server] Make timed-out rebalance tasks recoverable - #3860
swuferhong wants to merge 3 commits into
Conversation
a152704 to
299a769
Compare
platinumhamburg
left a comment
There was a problem hiding this comment.
LGTM +1.
I have left three non-blocking suggestions concerning operational configurability and regression coverage.
299a769 to
9efad45
Compare
d7dc9b3 to
eb5da01
Compare
eb5da01 to
e8fb787
Compare
fxbing
left a comment
There was a problem hiding this comment.
Thanks for your contribution! I've run into this issue as well and left a few comments for you to take a look at.
| return; | ||
| } | ||
|
|
||
| for (Map.Entry<TableBucket, RebalancePlanForBucket> entry : |
There was a problem hiding this comment.
Could rebuilding all plans as pending leave existing migrations outside the admission limit during recovery?
A local Manager/serde probe reproduced this with maxTrackedTimedOutTasks=1:
- Start bucket A, leave its assignment at the union state, and move it to
TIMEOUT. Further admission is correctly blocked. - Serialize and reload the persisted task, then recover a new manager while preserving A's union assignment.
- Exercise a recovery order where a previously unstarted bucket B appears before A.
B is then admitted while A remains pending. Both buckets have union assignments, but A's execution key and rebalance-plan lookup return null.
The probe used 12 colliding TableBucket keys—new TableBucket(i + 1L, 31 * (11 - i)), for i=0..11—to exercise a different iteration order after deserialization. It used the real Manager/serde/context with a fake executor, so this demonstrates the admission and tracking behavior rather than actual TabletServer traffic.
There was a problem hiding this comment.
Agreed. Recovery now classifies every persisted bucket before admitting any new work. Buckets that are no longer at origin are restored directly as tracked TIMEOUT attempts with an execution key and an immediate reconciliation event. Only after all buckets have been classified does normal admission run, so an intermediate migration is discovered before the maxTrackedTimedOutTasks check can admit another origin task.
Keep timed-out bucket migrations under bounded reconciliation while admitting new work. Persist cancellation intent and final status, recover intermediate assignments, and require a current leader acknowledgement before completion. Fence stale responses and avoid repeated elections for applied leader moves. Expose recovery limits and replan failed migrations using the configured replica count. Document the state transitions and recovery settings, share test setup, and retain targeted failure and restart coverage. Exempt only ConfigOptions from the Checkstyle file length limit. Skip startup recovery on ZooKeeper read failure to allow new rebalance requests, and leave a TODO for recovery retries. Validation: 89 targeted and integration tests passed, including five rebalance integration cases. After the startup recovery adjustment, reran all 35 RebalanceManagerTest cases successfully. Checkstyle and Spotless checks passed. Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-6 AI-Contributed/Feature: 7/7 AI-Contributed/UT: 0/0
Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-5.6-sol AI-Contributed/Feature: 58/58 AI-Contributed/UT: 208/208
e8fb787 to
ea7ff36
Compare
Co-Authored-By: Codex <noreply@openai.com> Co-Authored-By: Qoder <noreply@qoder.com> AI-Model: gpt-6 AI-Contributed/Feature: 149/149 AI-Contributed/UT: 29/29 Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-5.6-sol AI-Contributed/Feature: 60/60 AI-Contributed/UT: 84/84
Purpose
Linked issue: close #3859
Treat rebalance timeout as a non-final state and continue tracking timed-out bucket migrations without blocking subsequent tasks.
Fence stale timeout and NotifyLeaderAndIsr events by rebalance attempt and request epochs. Reconcile migrations idempotently from persisted assignment and LeaderAndIsr state, and recover unfinished tasks after coordinator restart.
Persist cancellation intent before changing local state, drain admitted tasks safely, retry final-state persistence, and treat deleted buckets as completed.
Brief change log
Tests
API and Format
Documentation