Open barrucadu opened 8 years ago
This is how the initial Raft description worked as well, sort of: distributing entries was piggybacked on heartbeats, and could be 'sped up' by injecting a fake intermediate heartbeat. So yes, that's the way it's supposed to be done, though I admit it's non-obvious.
Wrt your last comment, this is also the way Raft was defined. I agree this approach is not the most efficient, but it is correct, the system will converge. My goal for Kontiki was to be as close to the Raft spec (in its draft version back then) as possible (but using uni-directional messages instead of RPC), have it correct, and then maybe improve efficiency where possible.
I've been playing with this library today, and figuring out how to actually use it has been a bit tricky, so I just wanted to confirm my understanding is correct:
To replicate a new entry from the leader:
Raft.handle
with anEHeartbeatTimeout
event to generate the replication commands.This seems to work, but the use of an
EHeartbeatTimeout
was very non-obvious, so I want to check I haven't missed anything. Also, this method doesn't work if multiple entries have been appended, as the defaulthandleHeartbeatTimeout
only sends the latest entry.