Skip to content

Add an implementation of the Raft consensus protocol#223

Merged
Bismanpal-Singh merged 81 commits intoapache:dev-raftfrom
hammerface:raft
May 3, 2026
Merged

Add an implementation of the Raft consensus protocol#223
Bismanpal-Singh merged 81 commits intoapache:dev-raftfrom
hammerface:raft

Conversation

@JoshHuttonCode
Copy link
Copy Markdown

@JoshHuttonCode JoshHuttonCode commented Jan 6, 2026

An implementation of the Raft Consensus Protocol into ResilientDB. This implementation is still in progress. Currently missing is the ability to send and receive snapshots between replicas, as well as some additional test cases.

hammerface and others added 30 commits November 4, 2025 19:35
fixed a race condition in deploy_local.sh
Also updated ReceiveTransaction
Also updated ReceiveAppendEntries
@msadoghi msadoghi added this to the Release v1.13.0 Planning milestone Feb 17, 2026
JoshHuttonCode and others added 20 commits February 17, 2026 14:56
Tests now work again after adding Recovery.
Addressed minor test concerns.
Add Log Truncation support to Raft Recovery. This includes a new WALRecord and TruncationRecord protobuf message.
Move LastLogIndex and log_ resizing into AddToLog and TruncateLog.
Add PrintDebugStateLocked() so that PrintDebugState() can be called under the lock.
Change Recovery to not ignore all recovery data if a portion of the data is wrong.
For checkpointing, we need to separate the logical log index and size from the actual indexing and size of the vector.
Refactor the Recovery class to pull out the code that will be used for RaftRecovery. There are now 2 derived classes, one for PBFT's Recovery and one for Raft's Recovery.
@Bismanpal-Singh Bismanpal-Singh changed the base branch from master to dev-raft April 29, 2026 23:33
JoshHuttonCode and others added 4 commits May 1, 2026 13:03
Added some handling to deal with snapshotting in Raft. Checkpoints will be taken, the last snapshot index and term need to be stored, and index arithmetic needs to be accounted for. Note that this largely is not yet in use, as the hook to actual truncate a prefix in Consensus is currently commented out. Once there is handling to send and receive Snapshots, this will be used.

Added a callback hook in recovery to let the consensus protocol know when a checkpoint has finished and up to what seq it covers.

Moved some Raft test header functionality into a general Raft test utility to not be attached to that specific text fixture.

Added some new tests for existing Raft features.

Updated lastApplied_ in Raft to be lastCommitted (meaning we have queued it to be committed). lastApplied is now tracked in Raft's Consensus class.

Fixed a bug with min_seq_ tracking in Recovery.

Fixed potential issues with edge cases in ReadLogsFromFiles.
This adds snapshotting to Raft, using ResilientDB's Checkpointing system.

Added some handling to deal with snapshotting in Raft. Checkpoints will be taken, the last snapshot index and term need to be stored, and index arithmetic needs to be accounted for. Note that this largely is not yet in use, as the hook to actual truncate a prefix in Consensus is currently commented out. Once there is handling to send and receive Snapshots, this will be used.

Added a callback hook in recovery to let the consensus protocol know when a checkpoint has finished and up to what seq it covers.

Moved some Raft test header functionality into a general Raft test utility to not be attached to that specific text fixture.

Added some new tests for existing Raft features.

Updated lastApplied_ in Raft to be lastCommitted (meaning we have queued it to be committed). lastApplied is now tracked in Raft's Consensus class.

Fixed a bug with min_seq_ tracking in Recovery.

Fixed potential issues with edge cases in ReadLogsFromFiles.
@JoshHuttonCode
Copy link
Copy Markdown
Author

@Bismanpal-Singh I have fixed the merge conflicts.

@Bismanpal-Singh Bismanpal-Singh merged commit 42547e4 into apache:dev-raft May 3, 2026
@Bismanpal-Singh
Copy link
Copy Markdown
Contributor

Merged in a new development branch specific to this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants