Skip to content

Commit

Permalink
kvserver: clean-up interaction between the mergeQueue and `AdminReloc…
Browse files Browse the repository at this point in the history
…ateRange`

This commit makes it such that the `mergeQueue` no longer has to take special
care to avoid a lease transfer when calling into `AdminRelocateRange`. This was
enabled by cockroachdb#75676.

The preceding logic can be cleaned up in the 22.2 cycle.

Release note: None
  • Loading branch information
aayushshah15 authored and RajivTS committed Mar 6, 2022
1 parent c833091 commit 62e467d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/kv/kvserver/merge_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ func (mq *mergeQueue) process(

// AdminRelocateRange moves the lease to the first target in the list, so
// sort the existing leaseholder there to leave it unchanged.
//
// TODO(aayush): Remove this logic to move lease to the front for 22.2,
// since 22.1 nodes support the new `transferLeaseToFirstVoter` parameter
// for `AdminRelocateRange`.
lease, _ := lhsRepl.GetLease()
for i := range voterTargets {
if t := voterTargets[i]; t.NodeID == lease.Replica.NodeID && t.StoreID == lease.Replica.StoreID {
Expand All @@ -353,7 +357,7 @@ func (mq *mergeQueue) process(
rhsDesc.StartKey,
voterTargets,
nonVoterTargets,
true, /* transferLeaseToFirstVoter */
false, /* transferLeaseToFirstVoter */
); err != nil {
return false, err
}
Expand Down

0 comments on commit 62e467d

Please sign in to comment.