Storage engine, replication, failover and connectors
Entries D42 to D49 and the multi-site tests: raftdb-lsm, indexes on lsm tables, service install, zero-flag first run, connectors.
Unreleased version (Stage 0), section Added. Newest first.
raftdb-lsmpoint reads 2.3x faster (D49): a lazily built hash table per cached block replaces the walk inside the block (lsm random get through the server 734k/s to 1,047k/s, 79 % of the in-memory engine); cheap hasher for the block cache, one key hash per lookup, flat block index. No format change.- Secondary indexes on lsm tables (D48): entries inside the engine, maintained on every write, replicated as
INDEXrecords, used by counts, pages and sorted queries when they point to a small part of the table (bounded count first);raftdb_db::{index_key, plan_ranges, encode_index, Kind}. Fix: an index created on the in-memory engine was shipped to replicas only with the next write. - Replication, synchronous replicas and automatic failover for lsm tables (D47): a per-shard replication log in the in-memory engine's format (
repl-N.log,Config::repl_log), replayed at open and rewritten as a snapshot when it does not fit the engine; lsm and in-memory servers can follow each other.raftdb_db::{encode_put, encode_delete, encode_dict, decode_record}own the record format. - Server tables on
raftdb-lsm(D46):engine = lsm, per-table engine marker, exact document count, streaming scans, refusal of replication/clusters/indexes.raftdb-lsmblock cache and allocation-free lookups (random get 47.7k/s to 543k/s on test server A);Stats::entries. Shared server/http suites run on both engines; new tests of the LSM engine. raftdb-server install-service/uninstall-service(D45): systemd unit with a dedicated user and a sandbox (exposure 3.0 OK), or a Windows startup task;--printshows the plan. 5 unit tests; real install, crash restart, reinstall and uninstall verified on test server A.- Second multi-site test (test server C, test server A, test server B as servers, PC as client only): two runs, leader kill and leader-site cut, 49 acknowledged writes, none lost.
- The first multi-site test (test server A, test server B, PC through SSH tunnels): leader kill and site cut, 105 acknowledged writes, none lost.
- Zero-flag first run (D44):
raftdb-serveralone is a secure loopback server with a generatedadmin.password; profilessingle/primary/replica/cluster,raftdb.conf(key = value; command line > environmentRAFTDB_*> file > profile),--print-config,--check-config,raftdb-server init --profile,--open. 8 unit tests + 3 tests that run the real binary.install-serviceis still to do. raftdb-lsmbackground flush and compaction with write backpressure (32 M keys on test server A: worst put 8.6 ms, 0 stalls, throughput kept).raftdb-lsm(S10a, D43): a disk-resident storage engine (memtable, log segments, checksummed sorted files, leveled compaction, atomic manifest). Restart replays at most one memtable of log and does not read the data files: 0.36-0.37 s from 1 M to 32 M keys on test server A. Library only; connecting tables to it is the next slice.- Automatic failover (D42):
--cluster-id/--cluster-peers/--cluster-secret; Raft elects the primary, followers use log shipping, strict synchronous replication, a vote needs at least as much data, a former primary rejoins as a follower. Verified on test server A with three processes andkill -9under write load (takeover 1.2 s and 2.3 s, 16,223 acknowledged writes, none lost).raftdb-raftvotes carry a data rank (Node::set_rank). - Connectors for Elixir, R, OCaml, Dart and Lua (24/24 conformance scenarios each against a running Raft DB server on Linux). With Perl, Ruby, C and C++ that makes 14 languages.
- Connectors for Perl, Ruby, C and C++ (24/24 conformance scenarios each against a running Raft DB server; C and C++ also under AddressSanitizer and UBSan); a conformance driver for Linux.
raftdb-raft(S9a): the Raft consensus core as a pure state machine (pre-vote, election restriction, per-term no-op, learners, crash recovery) with a deterministic simulator that checks election safety, log matching, state-machine safety and leader completeness after every step under loss, duplication, reordering, partitions and crashes (9 tests; shown to catch a deliberately broken vote rule). Not yet wired into the server: automatic failover is the next slice.