Commit 699e87d3 authored by Yossi Gottlieb's avatar Yossi Gottlieb
Browse files

Fix: never revert term due to a snapshot.

parent 0990cf7b
...@@ -1486,7 +1486,8 @@ int raft_begin_load_snapshot( ...@@ -1486,7 +1486,8 @@ int raft_begin_load_snapshot(
if (last_included_term == me->snapshot_last_term && last_included_index == me->snapshot_last_idx) if (last_included_term == me->snapshot_last_term && last_included_index == me->snapshot_last_idx)
return RAFT_ERR_SNAPSHOT_ALREADY_LOADED; return RAFT_ERR_SNAPSHOT_ALREADY_LOADED;
me->current_term = last_included_term; if (me->current_term < last_included_term)
me->current_term = last_included_term;
me->voted_for = -1; me->voted_for = -1;
raft_set_state((raft_server_t*)me, RAFT_STATE_FOLLOWER); raft_set_state((raft_server_t*)me, RAFT_STATE_FOLLOWER);
me->current_leader = NULL; me->current_leader = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment