Skip to content

Commit

Permalink
kvserver: improve a comment in TransferLeaseTarget
Browse files Browse the repository at this point in the history
Release justification: comments only

Release note: None
  • Loading branch information
aayushshah15 committed Sep 8, 2021
1 parent b444f85 commit 4a10238
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/kv/kvserver/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1450,8 +1450,12 @@ func (a *Allocator) TransferLeaseTarget(

leaseholderReplQPS, _ := stats.avgQPS()
currentDelta := getQPSDelta(storeQPSMap, existing)
// NB: If the `bestOption` ends up being the current leaseholder, then the
// check below will fail since we know that `leaseholderReplQPS` must be
// greater than 0 (the `StoreRebalancer` only bothers rebalancing leases /
// replicas for ranges serving at least some traffic).
bestOption := getCandidateWithMinQPS(storeQPSMap, existing)
if bestOption != (roachpb.ReplicaDescriptor{}) &&
if bestOption != (roachpb.ReplicaDescriptor{}) && leaseholderReplQPS > 0 &&
// It is always beneficial to transfer the lease to the coldest candidate
// if the range's own qps is smaller than the difference between the
// leaseholder store and the candidate store. This will always drive down
Expand Down

0 comments on commit 4a10238

Please sign in to comment.