Skip to content

Commit

Permalink
r/persisted_stm: fixed skipping application of raft snapshot
Browse files Browse the repository at this point in the history
When `persisted_stm` starts it must apply both local and raft snapshot.

When Raft snapshot is present or local snapshot is out of date it must
be applied to the stm. Removed code that was setting next offset
preventing Raft snapshot from being applied.

Fixes: redpanda-data#15127

Signed-off-by: Michal Maslanka <michal@redpanda.com>
(cherry picked from commit c9c675e)
  • Loading branch information
mmaslankaprv authored and Michal Maslanka committed Jan 22, 2024
1 parent 12d6f55 commit dbec69d
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/v/cluster/persisted_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -564,23 +564,11 @@ ss::future<> persisted_stm<T>::start() {
_log.warn,
"Skipping snapshot {} since it's out of sync with the log",
_snapshot_backend.store_path());
vlog(
_log.debug,
"start with non-applied snapshot, set_next {}",
next_offset);
_insync_offset = model::prev_offset(next_offset);
set_next(next_offset);
}

_resolved_when_snapshot_hydrated.set_value();
} else {
auto offset = _c->start_offset();
vlog(_log.debug, "start without snapshot, maybe set_next {}", offset);

if (offset >= model::offset(0)) {
_insync_offset = model::prev_offset(offset);
set_next(offset);
}
vlog(_log.debug, "starting without snapshot");
_resolved_when_snapshot_hydrated.set_value();
}
co_await state_machine::start();
Expand Down

0 comments on commit dbec69d

Please sign in to comment.