Decision Records
This page keeps the architecture decision records (ADRs) from the June 2026 edition of the book and checks each one against the code at main 8a689c5c (2026-11-30). A record stays in force only where the current code still matches it. Records the code has moved past are marked superseded, with what replaced them.
The June records carried line counts, benchmark figures and test counts. Those numbers are stale and are not repeated here. Current measured figures are in Benchmarks.
Status legend
| Status | Meaning |
|---|---|
| Accepted | The decision holds and the code matches it. |
| Accepted, with known debt | The decision holds; a cost it accepted is still open. |
| Superseded | The code no longer follows the decision. The record names what replaced it. |
| Superseded in part | The core decision holds, but a named part of it has been replaced. |
Summary
| ADR | Decision | Status now |
|---|---|---|
| 001 | One LSM-tree engine for all data models | Accepted |
| 002 | Implement in Rust | Accepted |
| 003 | Speak existing wire protocols, proven by differential suites | Accepted |
| 004 | MVCC with effective READ COMMITTED | Superseded |
| 005 | Three expression evaluators, unify later | Accepted, with known debt |
| 006 | Text-splice binding, then typed binding | Superseded (typed binding complete) |
| 007 | Cost-based optimizer on by default | Accepted |
| 008 | Secondary indexes on a shared registry | Accepted, with known debt |
| 009 | Secure-by-default wires, dev auth behind a switch | Accepted (strengthened) |
| 010 | Encryption at rest scoped to the proxy path | Superseded in part |
| 011 | Per-database keyspaces | Accepted |
| 012 | Raft for replication | Accepted, with known debt |
| 013 | Status documents and EXPLAIN tell the truth | Accepted, mechanism changed |
ADR-001: One LSM-tree storage engine for all data models
Status: Accepted
Decision. Every data model (relational rows, documents, key-value, graph, time series, vectors) is stored in one LSM engine: memtable, write-ahead log, SSTables, compaction and a manifest. (source: src/storage/memtable.rs; src/storage/wal.rs; src/storage/sst.rs; src/storage/compaction.rs; src/storage/manifest.rs)
What changed since June. The June record repeated a key layout from WHITEPAPER.md with binary table and row ids. That layout does not match the code, and WHITEPAPER.md is not in the current tree. The real layout is:
- An
InternalKeyis the user key followed by a sequence number and an op type. (source:src/storage/mod.rs,InternalKey) -
NamespacedStorageprefixes each key with the database namespace. (source:src/storage/namespaced.rs,NamespacedStorage) - SQL rows sit at a
table:pkkey inside that namespace. (source: Keys and namespaces)
Consequences.
- One recovery path, one compaction policy and one encryption layer cover every wire. Encryption at rest applies to all data files because of this. (source:
src/storage/at_rest.rs;docs/status/2026-11-30-encryption-at-rest.md) - No model gets a purpose-built physical layout. Indexes therefore sit beside the data as registries (ADR-008). (source:
src/storage/mod.rs,SecondaryIndexRegistry) - Compaction keeps only the newest version of a key, so a snapshot held across a compaction is not protected. (source:
README.md, PostgreSQL known gaps; MVCC) - Isolation between databases had to be designed explicitly (ADR-011).
See Storage overview.
ADR-002: Implement in Rust
Status: Accepted
Decision. The server is one Rust crate. Its concurrency and storage building blocks are the Tokio runtime, parking_lot locks, the crossbeam skiplist, epoch and channel crates, and bincode for on-disk encoding. (source: Cargo.toml, tokio, parking_lot, crossbeam-skiplist, crossbeam-epoch, crossbeam-channel, bincode)
Consequences.
- Several subsystems rely on outside crates rather than in-house code: Tantivy for full-text indexing,
tonicfor gRPC,argon2for password hashing,aes-gcmfor encryption,mimallocas the allocator, andmluawith Lua 5.1 for Redis scripting. (source:Cargo.toml,tantivy,tonic,argon2,aes-gcm,mimalloc,mlua) -
bincodeencoding ofValuemakes changing that enum a format change. This is why collapsing theValuevariants is deferred (ROADMAP 5.52), andValue::Int8andValue::Float32still exist. (source:ROADMAP.md5.52;src/types/value.rs,Value) - Debug builds are slow enough that password hashing hurt test runs. A verify cache and a test switch exist; the original measurement has not been repeated (ROADMAP 6.60). (source:
src/auth/verify_cache.rs,verify_password_cached;ROADMAP.md6.60)
See Building.
ADR-003: Speak existing wire protocols, proven by differential suites
Status: Accepted
Decision. SynergyDB speaks the native protocol of each database it imitates, so existing drivers and tools connect without changes. A wire counts as proven only by a differential suite that runs the same commands against the real database and SynergyDB and compares the answers. (source: README.md, scorecard; How a wire is proven)
Current shape.
- 24 wires are listed, each Full or Preview. (source:
README.md, scorecard; Wire guides) - Suites run in three phases: the same connection, a second connection, and a restart after
kill -9. (source: How a wire is proven) - Preview means no real application has covered the command surface yet, there is no runnable local reference, or a known gap is open. (source:
README.md)
Consequences.
- Each wire carries its own protocol code under
src/protocol/, and some keep their own in-memory state that must be reloaded after recovery and on replicas. (source:src/storage/mod.rs,ReplicatedApplyListener) - A pass rate states only what the suite covers. The wire guides list the gaps the suites do not reach.
ADR-004: MVCC with effective READ COMMITTED isolation
Status: Superseded
June decision. Transactions used MVCC, but every isolation level behaved as READ COMMITTED: REPEATABLE READ and SERIALIZABLE were accepted and not enforced.
What replaced it. The isolation levels are now distinct:
-
ReadCommittedtakes one snapshot per statement and is the default for PostgreSQL sessions. (source:src/transaction/mvcc.rs,IsolationLevel;src/query/engine.rs,begin_transaction) -
SnapshotIsolationreads at the transaction start and validates write-write conflicts at commit. It backsREPEATABLE READand is the MySQL session default. (source:src/transaction/mvcc.rs,TransactionManager::validate;src/query/engine.rs,begin_isolation) -
Serializableadds read-write validation and an SSI cycle check, tested bytest_write_skew_detectedandtest_no_write_skew_different_keys. (source:src/transaction/ssi.rs,SsiTracker) - A concurrent change to a row read under Serializable raises SQLSTATE 40001. (source:
src/query/engine.rs,check_serializable_row)
See Isolation levels and SSI and Transaction errors.
Debt that remains. A snapshot held across a compaction is not protected (see ADR-001). (source: README.md, PostgreSQL known gaps)
ADR-005: Three expression evaluators, unify later
Status: Accepted, with known debt
Decision. The engine kept three expression evaluators rather than stopping feature work to merge them: evaluate_expr, evaluate_row_expr and get_expr_value_from_row. (source: src/query/engine.rs, evaluate_expr, evaluate_row_expr, get_expr_value_from_row)
Current state.
- All three still exist. (source:
src/query/engine.rs) - The catch-all arm of
evaluate_exprnow hands any expression it does not handle toevaluate_row_exprwith an empty row. This is the "catch-all" part of ROADMAP 5.49, marked done; removing the redundant arms is deferred. (source:src/query/engine.rs,evaluate_expr;ROADMAP.md5.49)
Debt. A function or operator can still behave differently depending on which evaluator reaches it. ROADMAP 1.24 names per-row column resolution in evaluate_row_expr as part of the remaining Odoo slowdown. (source: ROADMAP.md 1.24)
ADR-006: Text-splice parameter binding, then typed binding
Status: Superseded (the follow-up it planned is complete)
June decision. Bind prepared-statement parameters first by splicing their text into the SQL, then replace that with typed binding as a separate step after evaluator work.
What replaced it. Typed binding is the only path:
- Parameters are parsed as
Expr::Paramand bound by type. (source:src/query/sql/parser.rs,Expr::Param) - The text-splice helper
format_param_valueis no longer in the source tree. (source:src/, no definition offormat_param_value) -
SYNERGYDB_LEGACY_PARAMSis mentioned only in comments; no code reads it. (source:src/query/engine.rs)
ADR-007: Cost-based optimizer on by default
Status: Accepted
Decision. The optimizer runs on every statement unless switched off. SYNERGYDB_OPTIMIZER set to 0, false or off disables it; any other value or no value leaves it on. The value is read once per process. (source: src/query/engine.rs, optimizer_enabled)
EXPLAIN. EXPLAIN reports the access path the engine uses, with real cardinality when a statistics context is given. Tests include test_explain_ctx_index_scan, test_explain_ctx_seq_scan_real_cardinality and test_explain_no_ctx_unchanged. (source: src/plan/explain.rs, explain_plan_text_ctx; src/query/engine.rs, execute_explain)
Debt. Joins run at about 70% of PostgreSQL speed. Flight SQL is about 30 times behind DuckDB on TPC-H, and the status entry names join ordering and a vectorised executor as the work left. (source: README.md, PostgreSQL known gaps; docs/status/2026-11-30-flight-jdbc-and-exists.md)
See Query lifecycle.
ADR-008: Secondary indexes on a shared registry, wired step by step
Status: Accepted, with known debt
Decision. SQL secondary indexes and vector indexes live in shared in-memory registries that the scan path consults, with the base row re-read from storage. (source: src/storage/mod.rs, SecondaryIndexRegistry, VectorIndexRegistry)
Current state.
- The SQL registries are rebuilt, not persisted. (source:
src/storage/mod.rs,SecondaryIndexRegistry) - The cross-wire vector service saves its HNSW graphs under
vector_graphs/in the data directory. (source:src/vector/mod.rs;docs/status/2026-11-27-vector-graph-persist.md) -
Not wired: DiskANN, IVF-PQ, tiered vector storage and the persistent B-tree under
src/index/. The README says the[vector]tier thresholds "have no effect yet". (source:src/index/;README.md, "Engine features") -
Not wired: Tantivy full-text indexing is not reachable from SQL. (source:
README.md, PostgreSQL known gaps)
See Index overview.
ADR-009: Secure-by-default wires, dev auth behind an environment switch
Status: Accepted (strengthened since June)
Decision. Wires require authentication by default. Turning auth off for tests needs SYNERGYDB_DEV_INSECURE_AUTH. (source: src/lib.rs, lock_dev_insecure_auth_env; src/auth/wire_auth.rs, protected_mode)
What changed since June. The June record listed as a cost that there was no hard guard against running dev auth on a reachable address. There is one now: with a non-loopback bind, the server refuses to start with the dev switches set unless SYNERGYDB_ALLOW_INSECURE_BIND=1 is also set, and it refuses placeholder superuser passwords there. (source: src/main.rs, SYNERGYDB_ALLOW_INSECURE_BIND)
Other pieces now in place:
- Passwords are hashed with Argon2id; PostgreSQL also offers SCRAM-SHA-256. (source:
src/auth/password.rs,Algorithm::Argon2id;docs/status/2026-11-30-pg-scram.md) - Redis
PINGneeds auth. (source:src/protocol/redis/commands.rs,requires_auth)
Debt. MongoDB listDatabases is still allowed before auth (ROADMAP 1.25). See Known security gaps. (source: src/protocol/mongodb/commands.rs, allowed_preauth)
ADR-010: Encryption at rest scoped to the proxy path, fail-closed boot
Status: Superseded in part
June decision. Encryption at rest lived only in the encryption proxy, and the proxy refused to boot without a real master key rather than fall back to a built-in mock key.
What still holds. The proxy boot rule. The mock KMS is reached only when SYNERGYDB_DEV_INSECURE_AUTH is set; otherwise the proxy returns an error when no real key provider is configured. (source: src/proxy/mod.rs, KmsClient::with_mock call site)
What replaced the scope. The core store now encrypts its data files:
- AES-256-GCM with HKDF-SHA-512 subkeys. (source:
src/storage/at_rest.rs;src/storage/crypto.rs) - Off by default:
[storage] encryption_enabledis false unless set. (source:docs/status/2026-11-30-encryption-at-rest.md; Configuration reference) - Key rotation and checks run through the
synergydb encryptioncommands. (source:docs/status/2026-11-30-encryption-at-rest.md)
Debt. File metadata, the TLS key, the initial password, logs and memory are not encrypted. (source: docs/status/2026-11-30-encryption-at-rest.md)
See Security, encryption at rest.
ADR-011: Per-database isolation through separate keyspaces
Status: Accepted
Decision. Each database gets its own key prefix inside the shared engine, and a registry of databases is kept under its own key. (source: src/storage/namespaced.rs, NamespacedStorage)
Evidence. Tests in src/storage/namespaced.rs include isolates_same_logical_key_across_databases, scan_only_sees_own_namespace_and_strips_prefix, database_registry_create_list_drop, drop_database_purges_more_keys_than_one_batch, dropped_database_is_tombstoned_until_recreated, dropped_namespace_data_purged_across_flush_compaction_and_restart, point_get_and_scan_agree_after_drop_recreate_churn and default_and_empty_collapse_to_postgres. (source: src/storage/namespaced.rs)
Consequences.
- DDL undo for transactional DDL is kept alongside the namespace layer. (source:
src/storage/namespaced.rs,DdlUndoLog) - Row-level security policies are now stored per database. (source:
docs/status/2026-11-30-rls-policies-per-database.md)
See Keys and namespaces.
ADR-012: Raft for replication and consensus
Status: Accepted, with known debt
Decision. Replication uses a Raft implementation written for the project, with PreVote and InstallSnapshot. (source: src/distributed/raft.rs, RaftNode)
Current state.
- Writes replicate as
ReplicatedWriteentries throughRaftReplicationHook. (source:src/distributed/replication.rs) - Wires with in-memory state reload it on replicas through
ReplicatedApplyListener. Redis, Cassandra, CouchDB and InfluxDB do this. (source:src/storage/mod.rs,ReplicatedApplyListener;docs/status/2026-11-30-distributed-multiwire.md) - Followers refuse writes; on the PostgreSQL wire the error is SQLSTATE 25006. (source:
src/distributed/node_role.rs,RoleCell) - A multi-wire failover test exists as a script. (source:
test-scripts/cluster/multiwire_failover_test.py)
Debt.
-
Not wired: sharding and two-phase commit. (source:
src/distributed/coordinator.rs;ROADMAP.md4.56) - No read leases; follower reads have no staleness bound. (source:
ROADMAP.md4.55) - Memcached, Kafka, S3, ClickHouse, Elasticsearch, DynamoDB and Bolt do not replicate. (source:
docs/status/2026-11-30-distributed-multiwire.md) - The post-crash read gate
ready_to_serveis checked only on the PostgreSQL wire. (source:src/distributed/raft.rs,ready_to_serve;src/protocol/postgres/mod.rs)
See Raft and Sharding and 2PC.
ADR-013: Status documents and EXPLAIN tell the truth about what is wired
Status: Accepted; the mechanism has changed
Decision. Code that exists but is not on the live path is never presented as a feature. Status documents win over design documents, and EXPLAIN reports what actually runs.
What changed since June.
- The June mechanism relied on
WHITEPAPER.mdstatus markers.WHITEPAPER.mdis not in the current tree. (source: repository root listing) - Status is now recorded per change as dated entries in
docs/status/, andSTATUS.mdsays newer entries there win over it. (source:STATUS.md;docs/status/) - The README defines Full and Preview and keeps "Known gaps" and "Not validated end to end" lists. (source:
README.md) -
EXPLAINbehaviour is covered under ADR-007. (source:src/plan/explain.rs)
Debt. The discipline depends on upkeep, and the planning files have drifted: ROADMAP still lists as open several items the code has done, and the STATUS.md "What's still broken or missing" list is older than many ROADMAP "done" marks. See Roadmap. (source: ROADMAP.md; STATUS.md)