[ovs-dev] [PATCH 6/7] raft: Send all missing logs in one single append_request.

Han Zhou hzhou at ovn.org
Sat Feb 29 02:07:09 UTC 2020


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 at ovn.org>
---
 ovsdb/raft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index 0eb8644..c5c1d49 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -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) {
-- 
2.1.0



More information about the dev mailing list