Skip to content

Commit

Permalink
r/consensus: always use the latest configuration for followers metadata
Browse files Browse the repository at this point in the history
When install snapshot request in processed by the follower it may not
always replace the follower log content. If the snapshot last included
offset is smaller than the follower dirty offset the follower should
prefix truncate all the data up to the snapshot last included offset but
keep all the entries which offset is greater than snapshot last included
offset.

Fixed the update of follower metadata state as it was always using the
snapshot configuration instead the latest from the configuration
manager.

Fixes: #core-internal/issues/1310

Signed-off-by: Michał Maślanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Jun 24, 2024
1 parent 2f287e2 commit c69709f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/v/raft/consensus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,7 @@ ss::future<> consensus::hydrate_snapshot() {
co_await truncate_to_latest_snapshot(truncate_cfg.value());
}
_snapshot_size = co_await _snapshot_mgr.get_snapshot_size();
update_follower_stats(_configuration_manager.get_latest());
}

std::optional<storage::truncate_prefix_config>
Expand Down Expand Up @@ -2339,8 +2340,6 @@ void consensus::update_offset_from_snapshot(
_replication_monitor.notify_committed();
_event_manager.notify_commit_index();
}

update_follower_stats(metadata.latest_configuration);
}

ss::future<install_snapshot_reply>
Expand Down

0 comments on commit c69709f

Please sign in to comment.