Skip to content

Commit 35f4f90

Browse files
committed
kvserver: update allocator sync on errors in AdminTransferLease
Previously, the replicate queue could skip updating allocator sync when rlm.AdminTransferLease failed, due to early returns on error. This commit ensures allocator sync is always updated before exiting the function, regardless of success or failure.
1 parent 144b4a0 commit 35f4f90

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/kv/kvserver/replicate_queue.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,11 +1040,13 @@ func (rq *replicateQueue) TransferLease(
10401040
source,
10411041
target,
10421042
)
1043-
if err := rlm.AdminTransferLease(ctx, target.StoreID, false /* bypassSafetyChecks */); err != nil {
1043+
1044+
err := rlm.AdminTransferLease(ctx, target.StoreID, false /* bypassSafetyChecks */)
1045+
rq.as.PostApply(changeID, err == nil /*success*/)
1046+
1047+
if err != nil {
10441048
return errors.Wrapf(err, "%s: unable to transfer lease to s%d", rlm, target)
10451049
}
1046-
1047-
rq.as.PostApply(changeID, true /*success*/)
10481050
return nil
10491051
}
10501052

0 commit comments

Comments
 (0)