Replication and clustering

Status: built and open

An exact list of what replication and clustering features are built and tested, what is built but only partly verified, and what is open.

Sources: the stage tracker, the plan, decisions D38, D39, D42, D47, D50, D51 and their step records. Dates are those of the records (2026-11-09 to 2026-11-10).

Built and tested#

FeatureEvidence
Asynchronous log-shipping replicas: byte-identical logs, resume after restart, resync after a primary checkpoint, follow of dropped tables and new tables, manual promotionThree server tests, raftdb-db and raftdb-wal tests
Synchronous replication (sync-replicas, sync-timeout-ms), degraded-commit counterServer tests (replica holds each of 120 synchronous writes at once; timeout fallback; recovery)
Replication of lsm tables and indexes, either engine following the otherD47, D48
The fence: epoch, lease, role commands, dirty flag, data epoch, state report, control roletests of the fence and unit tests in fence.rs
Watcher quorum on raftdb-raft: election of a watcher leader, decrees, lease renewal rule, data ranking, fencing delay5 tests of the watcher quorum, 15 of 15 over three runs; the decision rules are plain functions with unit tests
Failover after kill -9 of the primary and of the primary's watcher; two primaries killed in a row; a minority never writableA real-process failover test on a 2-core Linux host: PASS, 19,527 acknowledged writes, 0 missing, never two writable nodes
Raft core: pre-vote, election restriction, no-op per term, commit rule, learners, crash recoverythe deterministic simulator of raftdb-raft with loss, duplication, reordering, partitions and crashes
Resource control (compaction and replication throttles by foreground latency, cgroups v2 limits)D51 step C3 (measured effect recorded there)
Table groups: one primary per group, forwarding, per-group failover, spread of primariesthree-group tests; a three-group real-process test on a 2-core Linux host
Handover of a primary on purpose, rebalancingD50 layer-1 leftovers record
Partitioned tables: create, route by key, queries and indexes over all partitionspartition tests; the L2d test on test server A
Placement rules (copies, spread, within, not_in, sync, read) for * and table= selectors; labels and capacity; a missing copy is built before a dead holder is dropped; the watcher never deletes data; release by the operatorplanner and watcher tests; runs on three servers and on a four-node test cluster (placement rules)
Parallel send to the followers (ship-early), off by defaultserver and log tests; a two-host run
Node health shared by the watchers: down only when two observers agree, kept across a change of leader, up only after a hold time, maintenance; servers name no down node to clients (node health)5 in-process watcher tests with scripted nodes (cut-off watcher, false suspicion, leader change mid-confirmation, maintenance, the placement map); a server test; a four-server real-process test with kill -9, restart and maintenance (two runs); client libraries follow the servers' answers and do not read the table themselves
Configuration set of a running cluster: written once on any watcher, checked before anything is stored, watcher settings applied by every watcher, a per-node table of applied, pending, refused and declined, revert, sync_replicas in the safe order (live configuration)6 in-process watcher tests with scripted nodes; server tests; a three-server real-process test under continuous writes (applied everywhere, a stopped server catches up, revert, refusal shown with its reason, sync_replicas raised and lowered, no acknowledged write lost)
A replica that logs in with the replication role account follows every database (a fault of earlier builds: it saw an empty catalog)replica_account test

Built, verified only partly#

FeatureWhat is missing
Failover timingOne run per setting, one host, loopback only, process kills only. No run on three machines, no network or disk failure, no repeated runs for a distribution.
Throughput with spread leadersShown only as 0 to 16% on one machine; not demonstrated as scaling (needs three machines).
PlatformsThe in-process cluster tests run on Windows; the kill -9 failover run was done on Linux only; the three-group script ran on Linux and Windows.
LinearizabilityNo Jepsen-style check has been run.

Not built (open)#

ItemNote
Raft replication of the data log itself (the committed Raft entry is the WAL record)The larger plan of option A; replaces log shipping and adds snapshots and membership change. Not started: PLAN-NEXT says "Not started until failover is proven", and it is now proven for the interim design.
Raft membership change, snapshots, log compaction, read indexraftdb-raft has none: "voters and learners are fixed at creation".
Adding or removing a node of a running clusterFollows from the above.
Replication of accounts (server accounts)Designed in PLAN-NEXT section 1; each node needs the same user lines today.
Conflict-resolving multi-master (several writers for one key, option B)Not planned: it changes the guarantees (a write could be silently overwritten).
Placement by key prefix, field value or key range; moving a table or a partition to another group; adding groups to a running clusterRules of those kinds are refused (needs_partition_key).
A node that comes back getting its groups by itselfAn operator releases a surplus copy and the planner restores the count.
Online split and merge of partitions; cross-partition transactions (two-phase commit)Layer 4 of D50: refused with a clear error before that.
Changing the number of groups on a running clusterNot supported.
Moving a table to another groupNot supported.
Reads from followers in group modeEvery request for a remotely led table is forwarded.
TLS between nodes and between watchersNone.
Backup and point-in-time recovery for a clusterNone.
Cross-datacentre replica, incremental backup from log shippingListed as V8 in the very-large-database plan.
HTTPS webhooks in the watcherPlain HTTP only (notify_command with curl for HTTPS).

The weaknesses the decision records state themselves#

  • Elections and data movement are two mechanisms, not one log: a bug between them (the dirty flag, the ranking) is the kind to look for (D50).
  • The watcher is part of the availability path: it must run as a quorum of three or more on separate machines; a bug in its decision rule can cause data loss the in-server version could not (the fence limits it to one writer at a time) (D51).
  • Lease timing assumes monotonic clocks that run at about the same speed (D51).
  • Failover takes seconds, not about one second as the interim in-server election did (D51 C4).
  • One decree at a time across all groups; leaders are rebalanced only by the timer or by hand (G1c).

See also#