Consistency Model
Write Consistency
A write is acknowledged only after:
- WAL append is persisted (O_DIRECT + fsync)
- Raft quorum commit (for replicated namespaces)
Single-node: linearizable writes for the shard leader. Replicated: linearizable writes within each Raft group.
Read Consistency Levels
-- Strong: leader-read after commit index >= required LSN (default for metadata/constraints)
SET read_consistency = 'strong';
-- Bounded staleness: follower read allowed if lag <= duration
SET read_consistency = 'bounded_staleness_5s';
-- Eventual: local read for CRDT edge sync (monotonic convergence)
SET read_consistency = 'eventual';
| Level | Behavior | Use case |
| Strong | Leader read, waits for commit index | Metadata, constraints, OLTP |
| Bounded Staleness | Follower read if lag within configured bound | Read replicas, analytics |
| Eventual | Local read, monotonic convergence | CRDT edge sync, NodeDB-Lite |
Serializable Snapshot Transactions
Cross-engine queries execute against a shared snapshot watermark. A query that combines vector search, graph traversal, and document field access sees a consistent point-in-time view across all engines.
Transaction blocks are serializable snapshot transactions. A block reads one snapshot, taken at its first statement. Every read sees that snapshot plus the block's own writes. At COMMIT, at the moment the writes apply, NodeDB checks that nothing the transaction read or overwrote changed after its snapshot. If something changed, COMMIT fails with SQLSTATE 40001 and the client retries the whole block.
- A read-only block commits without validation and never fails with
40001. - A snapshot older than
[tuning.network] txn_snapshot_max_age_secs(default 300) fails the next statement with40001. - A write that cannot be buffered inside a block is refused with SQLSTATE
25001. - Every isolation level a client requests runs serializable.
- An autocommit statement reads the current state at a per-statement cut.
AS OF SYSTEM TIMEworks on every collection.
Cross-Model Queries
RRF fusion and cross-engine joins include source watermarks in response metadata. This lets clients verify the freshness of results that span multiple engines.