raft: Integrate Raft library into transaction manager
This issue tracks the work of integrating Raft into the current storagemgr
's transaction manager. The detailed implementation is proposed in this comment:
- The
TransactionManager
is currently not trackingappendedLSN
andcommittedLSN
separately. We just have theappendedLSN
here but we'd need to separate those out for Raft.committedLSN
should be managed by Raft and incremented only once a log entry has been committed via Raft by appending the log entry to the log of the majority.- Transactions always start against the latest
committedLSN
. We're reading that currently here. Raft needs to hook here and thecommittedLSN
should be read through Raft. This ensures followers wait for any committed log entries that haven't yet been replicated from the leader, and that the leader will notice whether it has been dethroned by another replica.- We also need to plug Raft into the commit process which happens here. Raft should be invoked to commit the log entry with majority before we increment the
committedLSN
here.- The log entry application here needs to be updated to only apply up to
committedLSN
to ensure we don't apply log entries that haven't yet been committed.- Log entry pruning here likely needs to be updated to wait until the log entries have been replicated everywhere, or the leader has decided to drop the entry if a replica is unavailable.
Edited by Quang-Minh Nguyen