diff --git a/pkg/kv/kvserver/replica_raft.go b/pkg/kv/kvserver/replica_raft.go index 9b23f98e582d..68023bc5fc70 100644 --- a/pkg/kv/kvserver/replica_raft.go +++ b/pkg/kv/kvserver/replica_raft.go @@ -1423,11 +1423,11 @@ func maybeFatalOnRaftReadyErr(ctx context.Context, err error) (removed bool) { // be queued for Ready processing; false otherwise. func (r *Replica) tick( ctx context.Context, livenessMap livenesspb.IsLiveMap, ioThresholdMap *ioThresholdMap, -) (exists bool, err error) { +) (processReady bool, err error) { r.raftMu.Lock() defer r.raftMu.Unlock() defer func() { - if exists && err == nil { + if processReady && err == nil { // NB: since we are returning true, there will be a Ready handling // immediately after this call, so any pings stashed in raft will be sent. // NB: Replica.mu must not be held here. @@ -1530,7 +1530,9 @@ func (r *Replica) tick( // have been pending for 1 to 2 reproposal timeouts. r.refreshProposalsLocked(ctx, refreshAtDelta, reasonTicks) } - return true, nil + + processReady = r.mu.internalRaftGroup.HasReady() + return processReady, nil } func (r *Replica) processRACv2PiggybackedAdmitted(ctx context.Context) { diff --git a/pkg/kv/kvserver/store_raft.go b/pkg/kv/kvserver/store_raft.go index 9ed83fe322ca..c792c7f1d1a3 100644 --- a/pkg/kv/kvserver/store_raft.go +++ b/pkg/kv/kvserver/store_raft.go @@ -762,12 +762,12 @@ func (s *Store) processTick(_ context.Context, rangeID roachpb.RangeID) bool { start := timeutil.Now() ctx := r.raftCtx - exists, err := r.tick(ctx, livenessMap, ioThresholds) + processReady, err := r.tick(ctx, livenessMap, ioThresholds) if err != nil { log.Errorf(ctx, "%v", err) } s.metrics.RaftTickingDurationNanos.Inc(timeutil.Since(start).Nanoseconds()) - return exists // ready + return processReady } func (s *Store) processRACv2PiggybackedAdmitted(ctx context.Context, rangeID roachpb.RangeID) {