Raft in every range
Each range is a Raft group of its own, with its leader, its replicas and its log.
Each TeselaDB range is a Raft group of its own. The replicas of a range agree on the order of their writes among themselves, without going through a central coordinator.
How it works
range 42 range 43
┌─────────────┐ ┌─────────────┐
│ leader n1 │ ──log─▶ │ leader n2 │ ──log─▶ ...
│ replica n2 │ │ replica n3 │
│ replica n3 │ │ replica n1 │
└─────────────┘ └─────────────┘The leader of each range proposes writes in its log. If it goes down, the remaining replicas elect another. An entry is applied once a majority of the replicas have it on disk, so a slow or failed replica does not hold up the write while the others answer in time. With its lease, the leader answers reads without asking the others, and a follower can serve reads up to its closed timestamp without going through the leader.
Each core of each node runs many groups at once. Its Raft log is also the write-ahead log of storage. Above all of them sits Group 0, the Raft group that keeps the cluster metadata: the list of nodes, the catalogue of collections, the map of ranges with their replicas and the configuration that every machine shares.
What it means for your application
A write confirmed with w: "majority" survives the loss of any minority of the replicas of its range. Ranges are independent, so a problem in one does not slow the others.
Limits
A range needs a majority of its replicas to accept writes. A write waits for the disk of the majority, so distant replicas add latency.