Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I really enjoyed this post. I had a question, is the raft-boltdb instance the actual raft log where the sql commands are being written to then?

It looks like the apply method is responsible for writing the sql statements to the raft log as well as executing the sql queries. Is waiting for a quorum of writes to the raft log by the other members not needed? Or is this all just handled under the hood by the raft libraries being used.



It's all handled by the Raft libraries (I know this because rqlite uses the same Raft library at this blog post). When integrating with Hashicorp's Raft code, your code must implement Apply()[1]. The Hashicorp code promises not to call Apply() until a quorum of nodes have been persisted the data to the Raft log. That way when your code is called to modify your state machine (FSM), quorum has already been achieved by the Raft system.

Architecturally (in rqlite's case) a node looks something like this: https://docs.google.com/presentation/d/1Q8lQgCaODlecHa2hS-Oe...

[1] https://pkg.go.dev/github.com/hashicorp/raft#FSM


Thanks. So this embedding of a database engine into the Raft FSM is the general pattern then?

It looks like Phil's post uses boltdb for the Postgres storage engine as well as for Raft log(via Hashicorpo's implementation Raft lib.)

Thanks for the link to the slides as well. I've seen rqlite mentioned a few times in the last few week and so it was on my short list of things to read up on.


Yes, embedding any kind of store can work. For example, here is an in-memory KV store embedded in Raft:

https://github.com/otoolep/hraftd

This is kind of a reference use of Hashicorp's Raft.


Oh this is great. Thanks for the link.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: