Skip to content

Commit 70bd44d

Browse files
committed
kvserver: acquire Replica.mu when returning reproposal error
Epic: none Release note: None
1 parent 3ccf718 commit 70bd44d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pkg/kv/kvserver/replica_application_result.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,14 @@ func (r *Replica) tryReproposeWithNewLeaseIndex(ctx context.Context, origCmd *re
407407
// The tracker wants us to forward the request timestamp, but we can't
408408
// do that without re-evaluating, so give up. The error returned here
409409
// will go to back to DistSender, so send something it can digest.
410-
err := kvpb.NewNotLeaseHolderError(
410+
r.mu.RLock()
411+
defer r.mu.RUnlock()
412+
return kvpb.NewNotLeaseHolderError(
411413
*r.mu.state.Lease,
412414
r.store.StoreID(),
413415
r.mu.state.Desc,
414416
"reproposal failed due to closed timestamp",
415417
)
416-
return err
417418
}
418419
// Some tests check for this log message in the trace.
419420
log.VEventf(ctx, 2, "retry: proposalIllegalLeaseIndex")

0 commit comments

Comments
 (0)