Expand description
Multi-version concurrency control primitives (Phase 11).
This module is the foundation for SQLRite’s BEGIN CONCURRENT
story — see docs/concurrent-writes-plan.md
for the full sequenced design.
Surface as of Phase 11.3:
MvccClock— process-wide monotonicu64counter that hands out begin- and commit-timestamps. Persisted to the WAL header so timestamps don’t reuse the same value across reopens.ActiveTxRegistry— tracks the begin-timestamps of in-flight transactions;ActiveTxRegistry::min_active_begin_tsis the GC watermark.TxId/TxTimestampOrId— types the version chains carry.MvStore— the in-memory version index. Holds row chains keyed byRowID;read(row, begin_ts)implements the snapshot-isolation visibility rule (begin <= T < end).JournalMode— per-database setting toggled byPRAGMA journal_mode = ….Wal(default) keeps every pre-Phase-11 read path in place;Mvccis the opt-in that 11.4 will wire reads through.
The executor doesn’t consult MvStore yet — that wiring lives
in 11.4 alongside BEGIN CONCURRENT writes. Decoupling the
data structure (this PR) from the read/write integration (next
PR) keeps the diffs reviewable.
Re-exports§
pub use clock::MvccClock;pub use log::MVCC_BODY_MAGIC;pub use log::MVCC_FRAME_MARKER;pub use log::MvccCommitBatch;pub use log::MvccLogRecord;pub use registry::ActiveTxRegistry;pub use registry::TxHandle;pub use registry::TxId;pub use registry::TxTimestampOrId;pub use store::MvStore;pub use store::MvStoreError;pub use store::RowID;pub use store::RowVersion;pub use store::RowVersionChain;pub use store::VersionPayload;pub use transaction::ConcurrentTx;
Modules§
- clock
MvccClock— the logical-clock primitive that hands out begin- and commit-timestamps for MVCC transactions (Phase 11.2).- log
- MVCC commit log records — the WAL-resident representation of
BEGIN CONCURRENTwrites (Phase 11.9). - registry
ActiveTxRegistry— the live-transaction table that garbage collection consults to know which row versions are still possibly visible (Phase 11.2).- store
MvStore— the in-memory version index sitting in front of the pager (Phase 11.3 skeleton).- transaction
ConcurrentTx— per-ConnectionBEGIN CONCURRENTtransaction state (Phase 11.4).
Enums§
- Journal
Mode - Selects the durability + concurrency story a database operates
under. Toggled by
PRAGMA journal_mode = …(seecrate::sql::pragma::execute_pragma).