@@ -506,20 +506,6 @@ func (r *Replica) stagePendingTruncationRaftMuLocked(pt pendingTruncation) {
506
506
r .asLogStorage ().stagePendingTruncationRaftMuLocked (pt )
507
507
}
508
508
509
- func (r * replicaLogStorage ) stagePendingTruncationSharedRaftMuLockedMuLocked (pt pendingTruncation ) {
510
- // This code is shared between regular log truncations and snapshot-induced
511
- // truncations.
512
- r .shMu .trunc = pt .RaftTruncatedState
513
- // Ensure the raft log size is not negative since it isn't persisted between
514
- // server restarts.
515
- // TODO(pav-kv): should we distrust the log size if it goes negative?
516
- r .shMu .size = max (r .shMu .size + pt .logDeltaBytes , 0 )
517
- r .shMu .lastCheckSize = max (r .shMu .lastCheckSize + pt .logDeltaBytes , 0 )
518
- if ! pt .isDeltaTrusted {
519
- r .shMu .sizeTrusted = false
520
- }
521
- }
522
-
523
509
func (r * replicaLogStorage ) stageApplySnapshot (truncState kvserverpb.RaftTruncatedState ) {
524
510
r .raftMu .AssertHeld ()
525
511
@@ -584,7 +570,15 @@ func (r *replicaLogStorage) stagePendingTruncationRaftMuLocked(pt pendingTruncat
584
570
func () {
585
571
r .mu .Lock ()
586
572
defer r .mu .Unlock ()
587
- r .stagePendingTruncationSharedRaftMuLockedMuLocked (pt )
573
+ r .shMu .trunc = pt .RaftTruncatedState
574
+ // Ensure the raft log size is not negative since it isn't persisted between
575
+ // server restarts.
576
+ // TODO(pav-kv): should we distrust the log size if it goes negative?
577
+ r .shMu .size = max (r .shMu .size + pt .logDeltaBytes , 0 )
578
+ r .shMu .lastCheckSize = max (r .shMu .lastCheckSize + pt .logDeltaBytes , 0 )
579
+ if ! pt .isDeltaTrusted {
580
+ r .shMu .sizeTrusted = false
581
+ }
588
582
}()
589
583
590
584
// Clear entries in the raft log entry cache for this range up to and
0 commit comments