Short, prioritized plan for RustDB beyond the current SQL engine (SqlEngine: parse → plan → execute, shared by CLI and QUIC). Context on what is done vs in flight stays in README.md (sections SQL-92 compatibility, Implemented, What’s still evolving).
- Library surface: optional wrapper API (e.g.
Database+ ownedSqlEngineorConnection) so embedders do not depend on wiring details; keepSqlEngineas the low-level primitive.- Done (minimal):
SqlSession(src/sql_session.rs),Database::into_sql_engine, andopen_sql_engine(src/lib.rs).
- Done (minimal):
- Durability: define a commit point: append WAL records for DML/DDL (or checkpointed equivalents),
fsyncpolicy, and replay on open; alignCOMMITwith log sequence and page state.- Done (minimal): each explicit
COMMITappends a line todata_dir/.rustdb/commits.log; setRUSTDB_FSYNC_COMMIT=1tofsyncthat append. Structured WAL logs explicit transactions plus DMLData*records;SqlEngine::checkpointflushes heaps and appends a checkpoint record (sameLogWriter).
- Done (minimal): each explicit
- Recovery: integrate existing checkpoint/recovery modules in
src/logging/with the SqlEngine data directory lifecycle; tests for crash-after-append, crash-after-commit.- Done (minimal):
SqlEngine::openrunsRecoveryManager::recover_databaseondata_dir/.rustdb/wal(quiet, validation off) before openingLogWriter. Log analysis reads length-prefixed records. DML REDO/UNDO replays intoPageManageron open;CheckpointManageris attached when WAL is enabled (disable withRUSTDB_DISABLE_CHECKPOINT=1; periodic checkpoints withRUSTDB_AUTO_CHECKPOINT=1and optionalRUSTDB_CHECKPOINT_INTERVAL_SECS).
- Done (minimal):
- Isolation (later): stronger guarantees if needed (locking upgrades, snapshot isolation), building on current
RwLock+ MVCC direction insrc/core/.- Done (minimal):
SqlIsolationLeveladdsRepeatableReadandSerializable.RUSTDB_DEFAULT_ISOLATION(read_committed|repeatable_read|serializable) selects the level atBEGIN. RR/SER use a process-globalparking_lot::Mutexso at most one such transaction runs at a time. True snapshot isolation / MVCC for SQL scans is still future work.
- Done (minimal):
- DDL / catalog: serialize catalog consistently with heap files; expand
ALTER(column add/drop/rewrite) and document unsupported forms; stress tests for FK/PK under concurrency.- Done (engine v1): v1 JSON catalog snapshot and WAL
MetadataUpdatemarker on each successful save (see durability/recovery items above).ALTER TABLE:ADD COLUMN(optional column constraints),DROP COLUMN(guarded by PK/unique/FK/parent references),RENAME COLUMN/RENAME TO,MODIFY COLUMNfor common type changes andNOT NULL/DEFAULT(constraints onMODIFYare limited — useADD CONSTRAINTseparately). Heap rows are rewritten when needed;SchemaManager::rename_tablekeeps FK metadata aligned. Stress: concurrent child inserts under mutex (engine_alter_fk_many_inserts_under_contention). Full logical DDL redo in WAL remains future work.
- Done (engine v1): v1 JSON catalog snapshot and WAL
- Operational clarity: extend docs and smoke tests as behavior stabilizes (Docker stateful SQL smoke already covers constraints and session transactions).
- Partial: engine tests cover catalog reopen and commit-log append; extend docs/smoke as behavior stabilizes.
This is a living list; adjust order as durability and recovery become blocking for real workloads.