Thanks Xiang, I really appreciate your help!
One final question I have about etcd/raft. I have a question about the sample implementation.
There are two structs being used:
My understanding is that when an AppendEntry request is made the flow is:
leader:
1. wal.Save() - this includes an fsync to disk
2. raftStorage.Save()
follower
3. wal.Save() - this includes an sync to disk
4. raftStorage.Save()
quorum:
5. Commit()
That is, the AppendEntry is persisted to disk via fsync by quorum nodes before the commit is done. Is this correct? What is raftStorage for? Is it just a cache of the wal? Why is it called raftStorage? I find it confusing to be called raftStorage because it's in-memory and I can't imagine we would want to store this data in memory and not also on disk via fsync. This sample implementation is in fact durable/safe? And your etcdserver attempts to make an
optimization where 1 and 3 happen in parallel?
Thank you!
Susan