]> git.proxmox.com Git - mirror_ovs.git/commitdiff
raft: Fix next_index in install_snapshot reply handling.
authorHan Zhou <hzhou@ovn.org>
Sat, 29 Feb 2020 02:07:10 +0000 (18:07 -0800)
committerBen Pfaff <blp@ovn.org>
Fri, 6 Mar 2020 22:25:17 +0000 (14:25 -0800)
When a leader handles install_snapshot reply, the next_index for
the follower should be log_start instead of log_end, because there
can be new entries added in leader's log after initiating the
install_snapshot procedure.  Also, it should send all the accumulated
entries to follower in the following append-request message, instead
of sending 0 entries, to speed up the converge.

Without this fix, there is no functional problem, but it takes
uncessary extra rounds of append-requests responsed with "inconsistency"
by follower, although finally will be converged.

Signed-off-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
ovsdb/raft.c

index c5c1d49a8b353040d23c037ff94cf023928f8c19..16127348755905bbd17d615b7527e72a88489b17 100644 (file)
@@ -3997,8 +3997,9 @@ raft_handle_install_snapshot_reply(
     VLOG_INFO_RL(&rl, "cluster "CID_FMT": installed snapshot on server %s "
                  " up to %"PRIu64":%"PRIu64, CID_ARGS(&raft->cid),
                  s->nickname, rpy->last_term, rpy->last_index);
-    s->next_index = raft->log_end;
-    raft_send_append_request(raft, s, 0, "snapshot installed");
+    s->next_index = raft->log_start;
+    raft_send_append_request(raft, s, raft->log_end - s->next_index,
+                             "snapshot installed");
 }
 
 /* Returns true if 'raft' has grown enough since the last snapshot that