Move to past check for nil

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2022-10-27 17:30:07 -07:00
parent 3a5f465115
commit 121bf6ebb5

View File

@@ -6801,12 +6801,6 @@ func (mset *stream) processSnapshot(snap *streamSnapshot) (e error) {
qname := fmt.Sprintf("[ACC:%s] stream '%s' snapshot", mset.acc.Name, mset.cfg.Name)
mset.mu.Unlock()
// See if our state's first sequence is >= the leader's snapshot.
// This signifies messages have been expired, purged, deleted and the leader no longer has them.
if snap.FirstSeq < state.FirstSeq {
sreq.FirstSeq = state.FirstSeq + 1
}
// Bug that would cause this to be empty on stream update.
if subject == _EMPTY_ {
return errCatchupCorruptSnapshot
@@ -6817,6 +6811,12 @@ func (mset *stream) processSnapshot(snap *streamSnapshot) (e error) {
return nil
}
// See if our state's first sequence is >= the leader's snapshot.
// This signifies messages have been expired, purged, deleted and the leader no longer has them.
if snap.FirstSeq < state.FirstSeq {
sreq.FirstSeq = state.FirstSeq + 1
}
// Pause the apply channel for our raft group while we catch up.
if err := n.PauseApply(); err != nil {
return err