@@ -498,18 +498,18 @@ func (r *Replica) handleLeaseResult(
498
498
assertNoLeaseJump )
499
499
}
500
500
501
- // handleTruncatedStateResult is a post-apply handler for the raft log
502
- // truncation command. It updates the in-memory state of the Replica with the
503
- // new RaftTruncatedState and log size delta, and removes obsolete entries from
504
- // the raft log cache and sideloaded storage.
501
+ // handleTruncatedStateResultRaftMuLocked is a post-apply handler for the raft
502
+ // log truncation command. It updates the in-memory state of the Replica with
503
+ // the new RaftTruncatedState and log size delta, and removes obsolete entries
504
+ // from the raft log cache and sideloaded storage.
505
505
//
506
506
// The isDeltaTrusted flag specifies whether the raftLogDelta has been correctly
507
507
// computed. The loosely coupled truncations stack sets it to false if, for
508
508
// example, it failed to account for the sideloaded entries. The tightly coupled
509
509
// truncations have correct stats.
510
510
//
511
511
// TODO(pav-kv): simplify this.
512
- func (r * Replica ) handleTruncatedStateResult (
512
+ func (r * Replica ) handleTruncatedStateResultRaftMuLocked (
513
513
ctx context.Context ,
514
514
t kvserverpb.RaftTruncatedState ,
515
515
expectedFirstIndexPreTruncation kvpb.RaftIndex ,
@@ -531,7 +531,8 @@ func (r *Replica) handleTruncatedStateResult(
531
531
// is truncated "logically" first, and then physically under raftMu.
532
532
r .mu .Lock ()
533
533
r .shMu .raftTruncState = t
534
- r .handleRaftLogDeltaResult (raftLogDelta , isRaftLogTruncationDeltaTrusted )
534
+ r .handleRaftLogDeltaResultRaftMuLockedReplicaMuLocked (
535
+ raftLogDelta , isRaftLogTruncationDeltaTrusted )
535
536
r .mu .Unlock ()
536
537
537
538
// Clear any entries in the Raft log entry cache for this range up
@@ -558,9 +559,11 @@ func (r *Replica) handleTruncatedStateResult(
558
559
// there will be dangling files at the next start. Clean them up at startup.
559
560
}
560
561
561
- // handleRaftLogDeltaResult updates the raft log stats with the given delta.
562
- // Both Replica.{raftMu,mu} must be held.
563
- func (r * Replica ) handleRaftLogDeltaResult (delta int64 , isDeltaTrusted bool ) {
562
+ // handleRaftLogDeltaResultRaftMuLockedReplicaMuLocked updates the raft log
563
+ // stats with the given delta. Both Replica.{raftMu,mu} must be held.
564
+ func (r * Replica ) handleRaftLogDeltaResultRaftMuLockedReplicaMuLocked (
565
+ delta int64 , isDeltaTrusted bool ,
566
+ ) {
564
567
r .raftMu .AssertHeld ()
565
568
r .mu .AssertHeld ()
566
569
0 commit comments