-
Notifications
You must be signed in to change notification settings - Fork 4.1k
storage: rebalancing only considers range leader store #5737
Description
Rebalancing is performed by the "replicate queue" (storage/replicate_queue.go) which periodically checks every range it is a leader for and calls Allocator.ShouldRebalance. ShouldRebalance retrieves the store descriptor for the leader replica and calls balancer.improve which compares the store capacity/range-count against cluster averages. If rebalancing should be performed, a new replica is added and a subsequent pass of the "replicate queue" will take care of removing the "worst" replica in an over-replicated range.
There is a glitch in the above, though. If the leader replica for a range is on a "good" store while one of the other replicas is on a "bad" store, we won't perform rebalancing. balancer.improve should consider the worst replica store when making the rebalancing decision.