Commit 90a58349 authored by Yossi Gottlieb's avatar Yossi Gottlieb
Browse files

End snapshot fixes.

We can't assume commit index does not change between begin and end
snapshot, as AE responses may arrive.
parent 9b983183
...@@ -1285,11 +1285,10 @@ int raft_end_snapshot(raft_server_t *me_) ...@@ -1285,11 +1285,10 @@ int raft_end_snapshot(raft_server_t *me_)
return -1; return -1;
assert(raft_get_num_snapshottable_logs(me_) != 0); assert(raft_get_num_snapshottable_logs(me_) != 0);
assert(me->snapshot_last_idx == raft_get_commit_idx(me_));
/* If needed, remove compacted logs */ /* If needed, remove compacted logs */
raft_index_t i = 0, end = raft_get_num_snapshottable_logs(me_); raft_index_t i = log_get_base(me->log) + 1, end = me->snapshot_last_idx;
for (; i < end; i++) for (; i <= end; i++)
{ {
raft_entry_t* _ety; raft_entry_t* _ety;
int e = raft_poll_entry(me_, &_ety); int e = raft_poll_entry(me_, &_ety);
......
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