From dbec69d5400b732482c856ecabb384ce17430463 Mon Sep 17 00:00:00 2001 From: Michal Maslanka Date: Tue, 28 Nov 2023 14:46:43 +0100 Subject: [PATCH] r/persisted_stm: fixed skipping application of raft snapshot 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: #15127 Signed-off-by: Michal Maslanka (cherry picked from commit c9c675eb1586e18400d36bb5b5d708667a80efd8) --- src/v/cluster/persisted_stm.cc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/v/cluster/persisted_stm.cc b/src/v/cluster/persisted_stm.cc index 204a5ff63f1e..3429f6f1e851 100644 --- a/src/v/cluster/persisted_stm.cc +++ b/src/v/cluster/persisted_stm.cc @@ -564,23 +564,11 @@ ss::future<> persisted_stm::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();