Commit f8236e02 authored by Yossi Gottlieb's avatar Yossi Gottlieb
Browse files

Better fix to previous AE response issue.

To clarify, the desired behavior is:
1) Avoid false assertions.
2) Silently ignore AE responses which are stale or not monotonic (i.e.
current index < match index).
parent 5e336b8f
...@@ -311,7 +311,8 @@ int raft_recv_appendentries_response(raft_server_t* me_, ...@@ -311,7 +311,8 @@ int raft_recv_appendentries_response(raft_server_t* me_,
raft_index_t next_idx = raft_node_get_next_idx(node); raft_index_t next_idx = raft_node_get_next_idx(node);
assert(0 < next_idx); assert(0 < next_idx);
/* Stale response -- ignore */ /* Stale response -- ignore */
assert(match_idx <= next_idx - 1); if (r->current_idx < match_idx)
return 0;
if (r->current_idx < next_idx - 1) if (r->current_idx < next_idx - 1)
raft_node_set_next_idx(node, min(r->current_idx + 1, raft_get_current_idx(me_))); raft_node_set_next_idx(node, min(r->current_idx + 1, raft_get_current_idx(me_)));
else else
......
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