@@ -27,7 +27,7 @@ type snapWriteBuilder struct {
27
27
28
28
todoEng storage.Engine
29
29
sl stateloader.StateLoader
30
- writeSST func (context.Context , func (storage.Writer ) error ) error
30
+ writeSST func (context.Context , func (context. Context , storage.Writer ) error ) error
31
31
32
32
truncState kvserverpb.RaftTruncatedState
33
33
hardState raftpb.HardState
@@ -42,14 +42,9 @@ type snapWriteBuilder struct {
42
42
// prepareSnapApply writes the unreplicated SST for the snapshot and clears disk data for subsumed replicas.
43
43
func (s * snapWriteBuilder ) prepareSnapApply (ctx context.Context ) error {
44
44
_ = applySnapshotTODO // 3.1 + 1.1 + 2.5.
45
- if err := s .writeSST (ctx , func (w storage.Writer ) error {
46
- // Clear the raft state/log, and initialize it again with the provided
47
- // HardState and RaftTruncatedState.
48
- return s .rewriteRaftState (ctx , w )
49
- }); err != nil {
45
+ if err := s .writeSST (ctx , s .rewriteRaftState ); err != nil {
50
46
return err
51
47
}
52
-
53
48
_ = applySnapshotTODO // 3.2 + 2.1 + 2.2 + 2.3
54
49
return s .clearSubsumedReplicaDiskData (ctx , s .todoEng )
55
50
}
@@ -121,7 +116,7 @@ func (s *snapWriteBuilder) clearSubsumedReplicaDiskData(
121
116
totalKeySpans := append ([]roachpb.Span (nil ), keySpans ... )
122
117
for _ , subDesc := range s .subsumedDescs {
123
118
// We have to create an SST for the subsumed replica's range-id local keys.
124
- if err := s .writeSST (ctx , func (w storage.Writer ) error {
119
+ if err := s .writeSST (ctx , func (ctx context. Context , w storage.Writer ) error {
125
120
// NOTE: We set mustClearRange to true because we are setting
126
121
// RangeTombstoneKey. Since Clears and Puts need to be done in increasing
127
122
// order of keys, it is not safe to use ClearRangeIter.
@@ -200,7 +195,7 @@ func (s *snapWriteBuilder) clearSubsumedReplicaDiskData(
200
195
//
201
196
// We need to additionally clear [b,sn).
202
197
203
- if err := s .writeSST (ctx , func (w storage.Writer ) error {
198
+ if err := s .writeSST (ctx , func (ctx context. Context , w storage.Writer ) error {
204
199
return storage .ClearRangeWithHeuristic (
205
200
ctx , reader , w ,
206
201
keySpans [i ].EndKey , totalKeySpans [i ].EndKey ,
0 commit comments