Repository navigation
Openraft 0.10 makes most of its types pluggable, moves optional parts into separate crates, and adds configurable quorum rules, pipelined replication, Pre-Vote, leadership transfer and faster linearizable reads. It also fixes several safety bugs. It uses the Rust 2024 edition and needs Rust 1.88 or later.
Upgrade from 0.9
Upgrading requires code changes. The upgrade guide covers each breaking change.
With the default types, stored data needs no migration: log entries, membership, vote and snapshot metadata keep their 0.9 serialized form, and a Config that 0.9 serialized still decodes. Data and wire compatibility describes what 0.9 and 0.10 peers can exchange.
release-0.9 keeps receiving bug fixes until 0.11 development starts.
Major changes
- New crates. The async runtime abstraction moved to
openraft-rt, with runtimes inopenraft-rt-tokio,openraft-rt-compio,openraft-rt-monoioandopenraft-rt-sim. The v1 network API moved toopenraft-legacy.openraft-membershipprovides other quorum rules,openraft-multishares connections across Raft groups, andopenraft-metrics-otelexports OpenTelemetry metrics.openraft-rocksstoreandopenraft-sledstoreare no longer released. - Configurable types.
RaftTypeConfigselects the term, leader id, vote, payload, membership, error source, batch container and client-write responder. - Membership. A membership type defines separate read and write quorums and per-node roles;
openraft-membershipprovides threshold, weighted, grid, hierarchical and explicit memberships.change_membership()writes one log entry when the old and new quorums intersect. - Replication. The leader pipelines AppendEntries through
RaftNetworkV2::stream_append(). Followers report conflict hints that shorten the log-matching search, and consecutive appends merge into one storage write. - Elections and leadership. Optional Pre-Vote stops partitioned nodes from inflating the term, and
Trigger::transfer_leader()hands leadership to a chosen node. - Linearizable reads. Each read chooses its policy with
LinearizerOption. One heartbeat round answers every waiting read, andget_local_read_linearizer()serves lease reads without aRaftCoreround trip. - Safety fixes. A restarted leader wins a new election before it accepts proposals, instead of reusing log ids for different entries (#2167). A leader commits a blank entry of its own term before it changes membership, so two leaders cannot commit disjoint configs. A restarted follower keeps its vote lease, so a lease read on the old leader cannot miss a committed write. Startup rejects a store whose state machine misses purged logs (#2222).
More details
- Change log: every change since 0.9.26, with links to the commits.
- Upgrade guide: how to migrate code from 0.9.
- Documentation: guides, FAQ and API reference.