@@ -571,6 +571,14 @@ type Replica struct {
571
571
//
572
572
// TODO(pav-kv): audit all other fields and include here.
573
573
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
+
574
582
// The state of the Raft state machine.
575
583
// Invariant: state.TruncatedState == nil. The field is being phased out in
576
584
// favour of the one contained in logStorage.
@@ -587,14 +595,6 @@ type Replica struct {
587
595
mu struct {
588
596
// Protects all fields in the mu struct.
589
597
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
598
598
// Is the range quiescent? Quiescent ranges are not Tick()'d and unquiesce
599
599
// whenever a Raft operation is performed.
600
600
//
@@ -1250,7 +1250,7 @@ func (r *Replica) IsDestroyed() (DestroyReason, error) {
1250
1250
}
1251
1251
1252
1252
func (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
1254
1254
}
1255
1255
1256
1256
// IsQuiescent returns whether the replica is quiescent or not.
@@ -2672,11 +2672,11 @@ func (r *Replica) maybeWatchForMergeLocked(ctx context.Context) (bool, error) {
2672
2672
r .raftMu .Lock ()
2673
2673
r .readOnlyCmdMu .Lock ()
2674
2674
r .mu .Lock ()
2675
- if mergeCommitted && r .mu .destroyStatus .IsAlive () {
2675
+ if mergeCommitted && r .shMu .destroyStatus .IsAlive () {
2676
2676
// The merge committed but the left-hand replica on this store hasn't
2677
2677
// subsumed this replica yet. Mark this replica as destroyed so it
2678
2678
// 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 )
2680
2680
}
2681
2681
// Unblock pending requests. If the merge committed, the requests will
2682
2682
// notice that the replica has been destroyed and return an appropriate
0 commit comments