Table groups, partitions and the control plane
Entries for handover, partitioned tables, table groups, resource control, the watcher quorum and the control fence (D50, D51).
Unreleased version (Stage 0), section Added. Newest first.
- Planned handover of a table group (
POST /v1/control/handover?group=G&to=NODEon the watcher's status port): the old primary stops, the target catches up and takes over without waiting for a lease (about 1 s, against about 8 s for a failover). Rebalancing (control_rebalance_after_ms, default 60000): a group goes back to the node it prefers when nothing has changed for that long. Forwarding is pipelined: requests sent together to the same leader go in one write (600 requests: 96 ms one at a time, 8 to 15 ms batched on loopback);GET /v1/servershows the counters. - Import and rename on a partitioned table (D50 layer 2): import splits the lines by key, imports those of the partitions the node leads and lists the rest (202, with their leaders); rename moves every partition, all or none. Fix: with several groups a rename (plain or partitioned) now needs a node that leads group 0 and the groups of the old and the new names (409 not_leader otherwise); before, it could leave the renamed data on a node that then followed an empty table.
- Partitioned tables, step L2d (D50 layer 2): the test on real processes (test server A): routing by key, 409 naming the leader, queries and indexes over all partitions on every node,
kill -9of a partition's primary with no acknowledged row lost and no error for the partitions whose primary did not change. Fix: the watcher's agent now has one command thread per group, so a slow command for one group (a node taking a group over) no longer delays the lease renewals of the others (the writes of unchanged groups were refused for a moment after a kill). Throughput: no gain from three groups on a 2-core host, as in G1d; not a scaling measurement. - Partitioned tables, step L2c (D50 layer 2):
POST /v1/queryover a partitioned table scans all partitions and merges (counts, filters, SQL withORDER BY/LIMIT/OFFSET, cursors); index creation and checkpoint run on the partitions the node leads and list the others with their leaders (202); stats cover all partitions. Reads use the node's own copies. Import and rename on a partitioned table are still 501. - Fix (data loss in a failover under load): a node whose group was in the middle of a command reported a placeholder (dirty, data epoch 0) that the watcher ranked as real data, so a failover could give the group to an empty node and lose acknowledged writes. A busy group now reports its stored dirty flag and data epoch. The watcher logs the reports each
Assignwas decided from;GET /v1/servershows the replication state of every group. - Partitioned tables, step L2b (D50 layer 2): JSON put/get/delete on a partitioned table go to the partition
partition_of(key); the leader and write checks use that partition's group (HTTP answers 409 naming the leader); the binary protocol is refused on a partitioned table with a clear message. - Partitioned tables, step L2a (D50 layer 2):
POST .../tableswith"partitions": ncreates the physical tablesname~p0..; listed as one table; dropped whole; partitions are placed round-robin over the table groups; JSON API only (owner decision). Fix: a plain table could take the name of a partitioned one. Fix: the first assignment of a group waits longer for its preferred node (spreading flake under load). - The G1d test (D50 layer 1): three servers and three watchers with three table groups on real processes: spread primaries, writes and reads through every node,
kill -9of a group's primary (only that group pauses, nothing acknowledged lost), and write rates with the leaders spread against one leader on test server A, this PC and test server B (spread is 0 to 16 % higher on one machine; the scaling claim is not demonstrated; see D50 G1d). - Table groups under the watcher quorum (D50 layer 1, G1c):
cluster_groups; the quorum decrees one primary per group, spreads them over the nodes (preferred node per group, data wins), keeps leases, commands and failover per group; a node'sgroupsstate is read per group. Three nodes with three groups: three primaries on three nodes; a dead node moves only its own groups; nothing acknowledged is lost. - Forwarding (D50 layer 1, G1b): with
groups > 1a node passes binary-protocol requests for tables whose group another node leads to that node's primary and passes the replies back (reads included); HTTP answers409 not_leaderwith the primary's address, UDPREAD_ONLY; a node that knows no primary for a group refuses reads and writes of its tables. - Table groups in the server (D50 layer 1, step G1a):
groupssetting,raftdb_server::group_of, a fence and a replication follower per group, write checks by the group of the table (binary, UDP, HTTP),groupinPOST /v1/control/role, agroupsarray inGET /v1/control/state,control.stateversion 3 (reads version 2). Forwarding and the watcher side are the next steps. - Resource control (D51, C3):
raftdb-lsmRateLimiteron compaction output, a limiter on the replication sender, a foreground latency histogram and load figures inGET /v1/control/state,POST /v1/control/throttle,lsm-*tuning settings, and a watcher controller (resource_control) that slows compaction when the foreground p99 goes over its target and gives it back when there is room; optional cgroup v2 weights and limits. On test server A (small sample) the controller cut p99.9 and the worst read by about 2.5x and p99 by about 22 % with no loss of write throughput. - The C2 test: a real-process failover run for the watcher quorum (three servers, three watchers,
kill -9of a primary, of a primary's watcher, and of two primaries in a row); first run on test server A passed (D51 C2). - The watcher quorum (D51, C2):
cluster_peersmakesraftdb-watcha member of a Raft group of watchers that decides who the primary is (decreesAssign/Revoke), keeps its node under a lease, and fails over with a revoke, a wait and an assignment ranked by (data epoch, log position). Servers reportdataEpochinGET /v1/control/state. - The fence and control interface for nodes managed by a watcher (D51, C1):
control = true, epoch + lease + dirty flag stored on disk,POST /v1/control/role,GET /v1/control/state, thecontrolaccount role (no data access), writable only under an unexpired lease at the current epoch.