@@ -571,6 +571,14 @@ type Replica struct {
571571 //
572572 // TODO(pav-kv): audit all other fields and include here.
573573 shMu struct {
574+ // The destroyed status of a replica indicating if it's alive, corrupt,
575+ // scheduled for destruction or has been GCed. destroyStatus should only be
576+ // set while also holding the raftMu and readOnlyCmdMu.
577+ //
578+ // When this replica is being removed, the destroyStatus is updated and
579+ // RangeTombstone is written in the same raftMu critical section.
580+ destroyStatus
581+
574582 // The state of the Raft state machine.
575583 // Invariant: state.TruncatedState == nil. The field is being phased out in
576584 // favour of the one contained in logStorage.
@@ -587,14 +595,6 @@ type Replica struct {
587595 mu struct {
588596 // Protects all fields in the mu struct.
589597 ReplicaMutex
590- // The destroyed status of a replica indicating if it's alive, corrupt,
591- // scheduled for destruction or has been GCed.
592- // destroyStatus should only be set while also holding the raftMu and
593- // readOnlyCmdMu.
594- //
595- // When this replica is being removed, the destroyStatus is updated and
596- // RangeTombstone is written in the same raftMu critical section.
597- destroyStatus
598598 // Is the range quiescent? Quiescent ranges are not Tick()'d and unquiesce
599599 // whenever a Raft operation is performed.
600600 //
@@ -1250,7 +1250,7 @@ func (r *Replica) IsDestroyed() (DestroyReason, error) {
12501250}
12511251
12521252func (r * Replica ) isDestroyedRLocked () (DestroyReason , error ) {
1253- return r .mu .destroyStatus .reason , r .mu .destroyStatus .err
1253+ return r .shMu .destroyStatus .reason , r .shMu .destroyStatus .err
12541254}
12551255
12561256// IsQuiescent returns whether the replica is quiescent or not.
@@ -2672,11 +2672,11 @@ func (r *Replica) maybeWatchForMergeLocked(ctx context.Context) (bool, error) {
26722672 r .raftMu .Lock ()
26732673 r .readOnlyCmdMu .Lock ()
26742674 r .mu .Lock ()
2675- if mergeCommitted && r .mu .destroyStatus .IsAlive () {
2675+ if mergeCommitted && r .shMu .destroyStatus .IsAlive () {
26762676 // The merge committed but the left-hand replica on this store hasn't
26772677 // subsumed this replica yet. Mark this replica as destroyed so it
26782678 // doesn't serve requests when we close the mergeCompleteCh below.
2679- r .mu .destroyStatus .Set (kvpb .NewRangeNotFoundError (r .RangeID , r .store .StoreID ()), destroyReasonMergePending )
2679+ r .shMu .destroyStatus .Set (kvpb .NewRangeNotFoundError (r .RangeID , r .store .StoreID ()), destroyReasonMergePending )
26802680 }
26812681 // Unblock pending requests. If the merge committed, the requests will
26822682 // notice that the replica has been destroyed and return an appropriate
0 commit comments