Skip to content

Commit

Permalink
Fix: The snapshot installation blindly applies config to the server.
Browse files Browse the repository at this point in the history
If the server was previously in the member set which was captured in the config of
this snapshot, then the peer will appear to have "caught_up" in ::reconfigure. I do
not believe there is value in rolling back the config just to reapply it later once
log_sync occurs. `::commit_conf` performs a similar check.
  • Loading branch information
szmyd committed Jan 22, 2025
1 parent cf80969 commit 34eee32
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/handle_snapshot_sync.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,13 @@ bool raft_server::handle_snapshot_sync_req(snapshot_sync_req& req, std::unique_l
// LCOV_EXCL_STOP
}

reconfigure(req.get_snapshot().get_last_config());

auto snap_conf = req.get_snapshot().get_last_config();
ptr<cluster_config> c_conf = get_config();
ctx_->state_mgr_->save_config(*c_conf);
if (snap_conf->get_log_idx() > get_config()->get_log_idx()) {
ctx_->state_mgr_->save_config(*snap_conf);
reconfigure(req.get_snapshot().get_last_config());
c_conf = get_config();
}

precommit_index_ = req.get_snapshot().get_last_log_idx();
sm_commit_index_ = req.get_snapshot().get_last_log_idx();
Expand Down

0 comments on commit 34eee32

Please sign in to comment.