Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please confirm that my understanding of how to replicate state is correct. #21

Open
barrucadu opened this issue Oct 19, 2016 · 1 comment

Comments

@barrucadu
Copy link

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:

  1. Append that entity to the log.
  2. Call Raft.handle with an EHeartbeatTimeout event to generate the replication commands.
  3. Process those 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 default handleHeartbeatTimeout only sends the latest entry.

@NicolasT
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants