GitHub Repos advanced 3 min read Jul 27, 2026
Public Preview Sign in free for the full digest →

hashicorp/raft: the Go library that syncs servers

“A testing tool found a State Machine Safety violation in the Raft library under Consul and Nomad — HashiCorp confirmed it in six days, and it is still open.”

hashicorp/raft: the Go library that syncs servers
Source · github.com

“"Thanks for the thorough bug report @rohanpadhye! Really incredible work from you and Antithesis. I haven't had a chance to try and reproduce this yet, but at first glance it seems both legitimate and difficult to reproduce without a tool like Antithesis." — @schmichael, https:/...”

You know that feeling when you need three servers to agree on a single number and you realize you are about to write leader election yourself? The Raft paper describes the algorithm, but the paper does not hand you a network transport, a snapshot store, log compaction, or a way to add and remove servers while the cluster is live. Writing those yourself means debugging split-brain at 2am with no test harness that can reproduce it. hashicorp/raft's pitch is that all of it already exists in one Go package that HashiCorp runs in Consul, Nomad, and Vault.

godistributed-systemsconsensusraftopen-sourceinfrastructurehashicorp

Think of it like a group chat where only one person is allowed to type, and everyone else copies what they type into their own notebook. You give the library your own finite state machine — anything with an `Apply(log)` method — plus a place to store logs on disk. One node is elected leader; you call `Apply()` on it, it writes the entry to durable storage, replicates it to the other nodes, and once a majority has persisted it the entry is committed and handed to your FSM on every node. To keep the log from growing forever, the library snapshots your FSM state and deletes the old entries automatically. The design choice that makes it distinctive is asynchronous heartbeats: the leader's keep-alive pings are sent on a separate goroutine from actual data replication, so a leader with a slow disk does not lose its position and trigger an unnecessary election.

01
Batteries-included, not protocol-only — the package ships net_transport.go, tcp_transport.go, file_snapshot.go, and an in-memory transport in-tree, so you get a working cluster without writing your own networking layer first
02
Four direct dependencies — go.mod lists only go-hclog v1.6.3, go-metrics v0.6.0, go-msgpack/v2 v2.1.5, and testify v1.11.1, so adding consensus does not drag a tree of transitive packages into your build
03
Automatic snapshotting and log compaction — a dedicated runSnapshot goroutine persists FSM state and deletes superseded log entries without you scheduling anything, which is what stops disk usage growing without bound
04
Voter / Nonvoter / Staging server modes — you can attach a new node as a read-only replica that catches up before it gets a vote, so adding capacity does not put quorum at risk mid-transfer
05
Pre-Vote enabled by default since v1.7.0 — a candidate checks whether it could actually win before bumping the term, which cuts the term-inflation churn that a flapping node otherwise causes
06
Documented divergences from the paper — docs/divergence.md names all four places the implementation departs from Ongaro's thesis and why, so you can reason about your failure modes instead of guessing
07
Zero published CVEs — the GitHub security advisories page states "There aren't any published security advisories," verified 2026-07-27
Who it’s for

If you are a Go engineer building something that needs several machines to agree on one ordered log — a control plane, a distributed KV store, a scheduler — this is the shortest path from the Raft paper to running code, and Consul and Nomad both pin it in production. It is not for you if you already own your own networking and storage layers and want a deterministic core you drive yourself; etcd-io/raft is the better shape for that. It is also not for you if MPL-2.0 fails your legal review, since both named alternatives are Apache-2.0.

Worth exploring

Worth exploring with your eyes open. The adoption evidence is real — Consul and Nomad both pin v1.7.3, and GitHub counts 5,308 dependent repositories — but three open issues (#695 safety, #666 liveness, #697 InstallSnapshot livelock) all trace to the same async-heartbeat design, and none of them are fixed in any shipped release. The last tag is v1.7.3 from 2025-03-20 and the most recent CI run on main concluded failure on 2026-07-27, so if you adopt it now you are adopting the released version with known-open safety reports on the tracker.

Developer playbook
Tech stack, code snippet, sentiment, alternatives.
PM playbook
Adoption angles, user fit, positioning.
CEO playbook
Traction signals, ROI, build vs buy.
Deep-dive insight
Full long-form analysis, no fluff.
Easy mode
Core idea, fast — when you need the gist.
Pro mode
Technical nuance, edge cases, tradeoffs.
Read the full digest
Go beyond the preview

Deep-dive insight, Easy and Pro modes, plus action playbooks — the full breakdown is one tap away.

Underrated tools. Unfiltered takes.

Read the full digest in the Snaplyze app for deep-dive insight, Easy and Pro modes, and the playbooks you can actually use.

Install Snaplyze →