Skip to content

Commit

Permalink
Merge pull request redpanda-data#15945 from mmaslankaprv/fix-14220
Browse files Browse the repository at this point in the history
c/log_eviction_stm: do not request snapshot if already progressed
  • Loading branch information
mmaslankaprv authored Jan 8, 2024
2 parents 26c7b9b + 4433851 commit 57e7aca
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/v/cluster/log_eviction_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,24 @@ log_eviction_stm::do_write_raft_snapshot(model::offset truncation_point) {
max_collectible_offset,
truncation_point);
}
if (truncation_point <= _raft->last_snapshot_index()) {
vlog(
_log.trace,
"Skipping writing snapshot as Raft already progressed with the new "
"snapshot. Current raft snapshot index: {}, requested truncation "
"point: {}",
_raft->last_snapshot_index(),
truncation_point);
co_return;
}
vlog(
_log.debug,
"Requesting raft snapshot with final offset: {}",
truncation_point);
auto snapshot_data = co_await _raft->stm_manager()->take_snapshot(
truncation_point);

// we need to check snapshot index again as it may already progressed after
// snapshot is taken by stm_manager
if (truncation_point <= _raft->last_snapshot_index()) {
vlog(
_log.trace,
Expand Down

0 comments on commit 57e7aca

Please sign in to comment.