Why does the RocksDB example flush wal in apply_sm() vs append_entries() #616
-
I've observed in the RocksDB example code, that the WAL is not flushed during append_to_log(). It is, however, flushed during apply_to_state_machine(), which I found somewhat counter-intuitive. Is it possible to explain (or point to docs) about what happens during a node crash & recovery? We are designing our persistent storage, and of course understanding these topics become very important to that design. PS: I assume upon startup the first method called is Sorry for all the questions, thanks for your help 🙌 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This issue and the closing PR #619 should have answered part of your question:
Right.
Whether to apply these log has to be left to openraft to decide: If a leader has committed these log, the leader will send a committed-log-id to all nodes then every node calls
It does not have to: |
Beta Was this translation helpful? Give feedback.
This issue and the closing PR #619 should have answered part of your question:
Right.
The first step is to build a
RaftState
with the return value fromlast_applied_state()
and other method:https://github.com/datafuselabs/openraft/blob/cb2985ad6af8b0097e1842d4025f9532e1664fbd/openraft/src/raft_state.rs#L15
Whether to apply these log has to be left to openraft to decide: If a leader has committed these log, the leader w…