From 1d482bfc082defb792e6aaec3f27337e01522385 Mon Sep 17 00:00:00 2001 From: ahrtr Date: Fri, 27 May 2022 16:42:16 +0800 Subject: [PATCH] Move the local variable cps into the loop so that it will not continue to schedule checkpoints after it steps down the leader --- server/lease/lessor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/lease/lessor.go b/server/lease/lessor.go index d1599d60ebc..78ed1472edd 100644 --- a/server/lease/lessor.go +++ b/server/lease/lessor.go @@ -646,10 +646,10 @@ func (le *lessor) revokeExpiredLeases() { // checkpointScheduledLeases finds all scheduled lease checkpoints that are due and // submits them to the checkpointer to persist them to the consensus log. func (le *lessor) checkpointScheduledLeases() { - var cps []*pb.LeaseCheckpoint - // rate limit for i := 0; i < leaseCheckpointRate/2; i++ { + var cps []*pb.LeaseCheckpoint + le.mu.Lock() if le.isPrimary() { cps = le.findDueScheduledCheckpoints(maxLeaseCheckpointBatchSize)