Skip to content

Commit

Permalink
kvserver: stop transferring leases to draining/suspect nodes in the S…
Browse files Browse the repository at this point in the history
…toreRebalancer

This commit prevents the StoreRebalancer from transferring leases to replicas
on draining or suspect nodes. In some cases, we've seen this to cause new
leases to be pushed to nodes that take too long to drain or that are stuck
while draining due to other bugs.

Informs https://github.com/cockroachlabs/support/issues/1105

Release note: None
  • Loading branch information
aayushshah15 committed Sep 2, 2021
1 parent f6fc512 commit 2690ec2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/kv/kvserver/store_rebalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,14 @@ func (sr *StoreRebalancer) chooseLeaseToTransfer(
var raftStatus *raft.Status

preferred := sr.rq.allocator.preferredLeaseholders(conf, candidates)

// Filter both the list of preferred stores as well as the list of all
// candidate replicas to only consider live (non-suspect, non-draining)
// nodes.
const includeSuspectAndDrainingStores = false
preferred, _ = sr.rq.allocator.storePool.liveAndDeadReplicas(preferred, includeSuspectAndDrainingStores)
candidates, _ = sr.rq.allocator.storePool.liveAndDeadReplicas(candidates, includeSuspectAndDrainingStores)

for _, candidate := range candidates {
if candidate.StoreID == localDesc.StoreID {
continue
Expand Down

0 comments on commit 2690ec2

Please sign in to comment.