@@ -158,7 +158,10 @@ func CollectStoresReplicaInfo(
158
158
return loqrecoverypb.ClusterReplicaInfo {}, CollectionStats {}, errors .New ("can't collect info from stored that belong to different clusters" )
159
159
}
160
160
nodes [ident .NodeID ] = struct {}{}
161
- if err := visitStoreReplicas (ctx , reader , ident .StoreID , ident .NodeID ,
161
+ // TODO(sep-raft-log): use different readers when the raft and state machine
162
+ // engines are separate. Since the engines are immutable in this path, there
163
+ // is no question whether to and in which order to grab engine snapshots.
164
+ if err := visitStoreReplicas (ctx , reader , reader , ident .StoreID , ident .NodeID ,
162
165
func (info loqrecoverypb.ReplicaInfo ) error {
163
166
replicas = append (replicas , info )
164
167
return nil
@@ -178,18 +181,18 @@ func CollectStoresReplicaInfo(
178
181
179
182
func visitStoreReplicas (
180
183
ctx context.Context ,
181
- reader storage.Reader ,
184
+ state , raft storage.Reader ,
182
185
storeID roachpb.StoreID ,
183
186
nodeID roachpb.NodeID ,
184
187
send func (info loqrecoverypb.ReplicaInfo ) error ,
185
188
) error {
186
- if err := kvstorage .IterateRangeDescriptorsFromDisk (ctx , reader , func (desc roachpb.RangeDescriptor ) error {
189
+ if err := kvstorage .IterateRangeDescriptorsFromDisk (ctx , state , func (desc roachpb.RangeDescriptor ) error {
187
190
rsl := stateloader .Make (desc .RangeID )
188
- rstate , err := rsl .Load (ctx , reader , & desc )
191
+ rstate , err := rsl .Load (ctx , state , & desc )
189
192
if err != nil {
190
193
return err
191
194
}
192
- hstate , err := rsl .LoadHardState (ctx , reader )
195
+ hstate , err := rsl .LoadHardState (ctx , raft )
193
196
if err != nil {
194
197
return err
195
198
}
@@ -199,7 +202,7 @@ func visitStoreReplicas(
199
202
// outcome, and they will become committed as soon as the replica is
200
203
// designated as a survivor.
201
204
rangeUpdates , err := GetDescriptorChangesFromRaftLog (
202
- ctx , desc .RangeID , rstate .RaftAppliedIndex + 1 , math .MaxInt64 , reader )
205
+ ctx , desc .RangeID , rstate .RaftAppliedIndex + 1 , math .MaxInt64 , raft )
203
206
if err != nil {
204
207
return err
205
208
}
0 commit comments