@@ -14,7 +14,6 @@ import (
14
14
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/apply"
15
15
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvstorage"
16
16
"github.com/cockroachdb/cockroach/pkg/roachpb"
17
- "github.com/cockroachdb/cockroach/pkg/storage/enginepb"
18
17
"github.com/cockroachdb/cockroach/pkg/util/log"
19
18
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
20
19
)
@@ -65,20 +64,12 @@ func (s destroyStatus) Removed() bool {
65
64
// don't know the current replica ID.
66
65
const mergedTombstoneReplicaID roachpb.ReplicaID = math .MaxInt32
67
66
68
- func (r * Replica ) postDestroyRaftMuLocked (ctx context.Context , ms enginepb.MVCCStats ) error {
69
- // TODO(tschottdorf): at node startup, we should remove all on-disk
70
- // directories belonging to replicas which aren't present. A crash before a
71
- // call to postDestroyRaftMuLocked will currently leave the files around
72
- // forever.
73
- //
74
- // TODO(tbg): coming back in 2021, the above should be outdated. The ReplicaID
75
- // is set on creation and never changes over the lifetime of a Replica. Also,
76
- // the replica is always contained in its descriptor. So this code below should
77
- // be removable.
78
- //
79
- // TODO(pavelkalinnikov): coming back in 2023, the above may still happen if:
80
- // (1) state machine syncs, (2) OS crashes before (3) sideloaded was able to
81
- // sync the files removal. The files should be cleaned up on restart.
67
+ // postDestroyRaftMuLocked is called after the replica destruction is durably
68
+ // written to Pebble.
69
+ func (r * Replica ) postDestroyRaftMuLocked (ctx context.Context ) error {
70
+ // TODO(#136416): at node startup, we should remove all on-disk directories
71
+ // belonging to replicas which aren't present. A crash before a call to
72
+ // postDestroyRaftMuLocked will currently leave the files around forever.
82
73
if err := r .logStorage .ls .Sideload .Clear (ctx ); err != nil {
83
74
return err
84
75
}
@@ -135,7 +126,7 @@ func (r *Replica) destroyRaftMuLocked(ctx context.Context, nextReplicaID roachpb
135
126
}
136
127
commitTime := timeutil .Now ()
137
128
138
- if err := r .postDestroyRaftMuLocked (ctx , ms ); err != nil {
129
+ if err := r .postDestroyRaftMuLocked (ctx ); err != nil {
139
130
return err
140
131
}
141
132
if r .IsInitialized () {
0 commit comments