[FLUSS-2401] Fix race condition where rebalance completes before leaders migrate#2524
Open
ZuebeyirEser wants to merge 1 commit intoapache:mainfrom
Open
[FLUSS-2401] Fix race condition where rebalance completes before leaders migrate#2524ZuebeyirEser wants to merge 1 commit intoapache:mainfrom
ZuebeyirEser wants to merge 1 commit intoapache:mainfrom
Conversation
98e4ea8 to
00915d0
Compare
00915d0 to
60723a9
Compare
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 #2405
Brief change log
This PR fixes a race condition where a rebalance task could be marked as
COMPLETEDbefore the old replicas were actually stopped and leaders were migrated. This was especially visible under high load (e.g., 400 buckets).The root cause was that
CoordinatorEventProcessorused a "fire-and-forget" approach forStopReplicarequests. It manually moved replicas to the Successful state immediately after sending the RPC.Major changes:
RebalanceManagerto trackpendingDeletionsfor each bucket.CoordinatorEventProcessorto wait for theDeleteReplicaResponseReceivedEventcallback before marking a task as finished.DeadTabletServerEventso rebalance tasks don't hang if a server dies while waiting for a response.RebalanceManager#buildClusterModelrobustness to skip leaderless buckets (avoids crashes during table initialization).TableManager).Tests
RebalanceRaceConditionITCase(regression test with 50 tables/400 buckets).RebalanceITCasewith stricter leader-count assertions.CoordinatorEventProcessorTestcases pass.API and Format
no
Documentation
no