Skip to content

Commit df9806a

Browse files
committed
loqrecovery: TODO
Epic: none Release note: none
1 parent 7dbbb8c commit df9806a

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

pkg/kv/kvserver/loqrecovery/apply.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ func applyReplicaUpdate(
317317

318318
hs.LeadEpoch = 0
319319

320+
// TODO(sep-raft-log): when raft and state machine engines are separated, this
321+
// update must be written to the raft engine.
320322
if err := sl.SetHardState(ctx, readWriter, hs); err != nil {
321323
return PrepareReplicaReport{}, errors.Wrap(err, "setting HardState")
322324
}

pkg/kv/kvserver/loqrecovery/collect.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ func visitStoreReplicas(
192192
if err != nil {
193193
return err
194194
}
195+
// TODO(pav-kv): the LoQ recovery flow uses only the applied index, and the
196+
// HardState.Commit loaded here is unused. Consider removing. Make sure this
197+
// doesn't break compatibility for ReplicaInfo unmarshalling.
195198
hstate, err := rsl.LoadHardState(ctx, raft)
196199
if err != nil {
197200
return err
@@ -201,6 +204,10 @@ func visitStoreReplicas(
201204
// at potentially uncommitted entries as we have no way to determine their
202205
// outcome, and they will become committed as soon as the replica is
203206
// designated as a survivor.
207+
// TODO(sep-raft-log): decide which LogID to read from. If the raft and
208+
// state machine readers are slightly out of sync, the LogIDs may mismatch.
209+
// For the heuristics here, it would probably make sense to read from the
210+
// latest LogID in the raft engine.
204211
rangeUpdates, err := GetDescriptorChangesFromRaftLog(
205212
ctx, desc.RangeID, rstate.RaftAppliedIndex+1, math.MaxInt64, raft)
206213
if err != nil {

pkg/kv/kvserver/loqrecovery/server.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ func (s Server) ServeLocalReplicas(
136136
g.Go(func() error {
137137
// TODO(sep-raft-log): when raft and state machine engines are separate,
138138
// we need two snapshots here. This path is online, so we should make sure
139-
// these snapshots are consistent. In particular, the LogID must match
140-
// across the two.
139+
// these snapshots are consistent (in particular, the LogID must match
140+
// across the two), or make sure that LogID mismatch is handled in
141+
// visitStoreReplicas.
141142
reader := s.TODOEngine().NewSnapshot()
142143
defer reader.Close()
143144
return visitStoreReplicas(ctx, reader, reader, s.StoreID(), s.NodeID(),

0 commit comments

Comments
 (0)