@@ -86,6 +86,22 @@ func ClearRangeData(
86
86
return nil
87
87
}
88
88
89
+ // DestroyReplicaTODO is the plan for splitting DestroyReplica into cross-engine
90
+ // writes.
91
+ //
92
+ // 1. Log storage write (durable):
93
+ // 1.1. Write WAG node with the state machine mutation (2).
94
+ // 2. State machine mutation:
95
+ // 2.1. Clear RangeID-local un-/replicated state.
96
+ // 2.2. (optional) Clear replicated MVCC span.
97
+ // 2.3. Write RangeTombstone with next ReplicaID/LogID.
98
+ // 3. Log engine GC (after state machine mutation 2 is durably applied):
99
+ // 3.1. Remove previous LogID.
100
+ //
101
+ // TODO(sep-raft-log): support the status quo in which 1+2+3 is written
102
+ // atomically, and 1.1 is not written.
103
+ const DestroyReplicaTODO = 0
104
+
89
105
// DestroyReplica destroys all or a part of the Replica's state, installing a
90
106
// RangeTombstone in its place. Due to merges, splits, etc, there is a need
91
107
// to control which part of the state this method actually gets to remove,
@@ -109,6 +125,7 @@ func DestroyReplica(
109
125
if diskReplicaID .ReplicaID >= nextReplicaID {
110
126
return errors .AssertionFailedf ("replica r%d/%d must not survive its own tombstone" , rangeID , diskReplicaID )
111
127
}
128
+ _ = DestroyReplicaTODO // 2.1 + 3.1 + 2.2
112
129
if err := ClearRangeData (ctx , rangeID , reader , writer , opts ); err != nil {
113
130
return err
114
131
}
@@ -124,6 +141,7 @@ func DestroyReplica(
124
141
return errors .AssertionFailedf (
125
142
"cannot rewind tombstone from %d to %d" , ts .NextReplicaID , nextReplicaID )
126
143
}
144
+ _ = DestroyReplicaTODO // 2.3
127
145
return sl .SetRangeTombstone (ctx , writer , kvserverpb.RangeTombstone {
128
146
NextReplicaID : nextReplicaID , // NB: nextReplicaID > 0
129
147
})
0 commit comments