Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MB-55062 Unlock all locked shards at the end of rebalance
During rebalance, shards can be locked during: a. Transfer to destination node b. Recovery on destination node If rebalance fails while the shard is being recovered, then the shards on source node has to be unlocked and the recovered data on destination node has to be deleted. Since there is only one token tracking the state, it is possible for the following race condition to happen: a. Destination node has read all transfesr tokens from metaKV b. Destination node has removed all local instances and deleted the metaKV token c. Source node tries to read metaKV tokens for cleanup As the token is removed at step (b), source not may not find the token and it will skip unlocking the shards. The issue is happening because both source and destination node are taking different actions on a single transfer token while the other node can potentially delete the token. To avoid these race conditions, shard transfer manager keeps a track of all shards that are locked during rebalance. At the end of rebalance, rebalance service manager will call "RestoreAndUnlockShards" API which will unlock all shards that are present on the node and yet to be unlocked due to rebalance. This ensures that all shards are properly unlocked at the end of rebalance. If any shard is destroyed during cleanup, it will be skipped from unlocking as unlock is not required for a shard that is destroyed. Change-Id: Ib43665734e61b68d736efdf7622b8019ad2de5fc
- Loading branch information
Showing
8 changed files
with
129 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ package indexer | |
|
||
type RebalanceProvider interface { | ||
Cancel() | ||
RestoreAndUnlockShards() | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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