Is it safe to send multiple entries in one AppendEntries call?

49 views
Skip to first unread message

Luca Lovagnini

unread,
Mar 4, 2015, 1:19:43 PM3/4/15
to raft...@googlegroups.com
Quoting the paper about the description of the parameter entries in AppendEntries section:

log entries to store (empty for heartbeat; may send more than one for efficiency)

I was thinking about how to implement this aspect: send more than one entry in one AppendEntries without doing any mess. I'll write my pseudo-code about what the Leader in order to ask you if it's a correct implementation or not:

Supposing that the leader is looking at the i-th follower

if (nextIndex.get(i) < log.size()) //if there are entries which are still not yet replicated
{
entries.addAll(log.subList(nextIndex.get(i),log.size()));
} 

in this way all the entries which are between nextIndex of the i-th follower and the leader will be replicated with one RPC call (instead that one entries per RPC like in RaftScope).

Do you think that it's a correct implementation?

Oren Eini (Ayende Rahien)

unread,
Mar 4, 2015, 1:21:56 PM3/4/15
to Luca Lovagnini, raft...@googlegroups.com
Yes, that is very common to do.
Make sure to limit the number of entries per batch, otherwise you might have so many that you will neve be able to send them all

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "raft-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luca Lovagnini

unread,
Mar 4, 2015, 1:37:02 PM3/4/15
to raft...@googlegroups.com, lucal...@gmail.com
Thanks for your reply and your hint, it will be done! :D
Reply all
Reply to author
Forward
0 new messages