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
TransactionManageris currently not trackingappendedLSNandcommittedLSNseparately. We just have theappendedLSNhere but we'd need to separate those out for Raft.committedLSNshould 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 thecommittedLSNshould 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
committedLSNhere.- The log entry application here needs to be updated to only apply up to
committedLSNto 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