]> git.proxmox.com Git - mirror_ovs.git/commitdiff
raft: Send all missing logs in one single append_request.
authorHan Zhou <hzhou@ovn.org>
Sat, 29 Feb 2020 02:07:09 +0000 (18:07 -0800)
committerBen Pfaff <blp@ovn.org>
Fri, 6 Mar 2020 22:01:18 +0000 (14:01 -0800)
When a follower needs to "catch up", leader can send N entries in
a single append_request instead of only one entry by each message.

The function raft_send_append_request() already supports this, so
this patch just calculate the correct "n" and use it.

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

index 0eb8644f395bcff05ae2335cda2c29e7d88a8ef2..c5c1d49a8b353040d23c037ff94cf023928f8c19 100644 (file)
@@ -3344,7 +3344,7 @@ raft_handle_append_reply(struct raft *raft,
         raft_send_install_snapshot_request(raft, s, NULL);
     } else if (s->next_index < raft->log_end) {
         /* Case 2. */
-        raft_send_append_request(raft, s, 1, NULL);
+        raft_send_append_request(raft, s, raft->log_end - s->next_index, NULL);
     } else {
         /* Case 3. */
         if (s->phase == RAFT_PHASE_CATCHUP) {