Message ID | 1582942030-31096-6-git-send-email-hzhou@ovn.org |
---|---|
State | Accepted |
Commit | 99c2dc8d04b3b697edfa02b06e127edad6ad5b28 |
Headers | show |
Series | [ovs-dev,1/7] raft-rpc.c: Fix message format. | expand |
On Fri, Feb 28, 2020 at 06:07:09PM -0800, Han Zhou wrote: > 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> I'm a little concerned about memory and message sizes here. It might be wise to limit them. All of the existing callers pass either 0 or 1 for 'n'. I'm going to apply this anyway, though.
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) {
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> --- ovsdb/raft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)