Ranges and replicas
What a range is, how it is replicated, who leads it and what happens when a node goes down.
A range is an interval [start, end) of the ordered key space. It is the unit of replication, placement and splitting:
each range has its own Raft group.
Leader and followers
One replica of each range is the leader: it proposes writes and, with its lease, answers reads without asking the
others. The other replicas follow its log. A follower can serve reads up to its closed timestamp, which the leader
publishes 3 seconds behind its clock; that is how readPreference: secondary and nearest work.
When a node goes down
The replicas of the ranges it led elect a new leader among those left, and the range keeps taking reads and writes while a majority of its replicas answer. Drivers retry the operation in flight; a retried write is not applied twice.
Split and merge
A range splits when it holds more than 64 MiB of live data or 512 MiB on disk with its versions, or by load. Two neighbours under 16 MiB, cold for 10 minutes and with the same replicas merge. A capped collection takes a range of its own that never splits or merges.
Look at your ranges
teseladb admin ranges --collection shop.orders