MagnumDB Engine Architecture
Technical analysis of MagnumDB's storage engine, 4 KB slotted page layout, B+ Tree index operations, LRU buffer pool manager, Write-Ahead Logging (WAL), MVCC, and Volcano query executor.
Architecture Overview
1. B+ Tree Storage Engine
MagnumDB organizes table data on disk into fixed 4096-byte pages. Internal nodes route key lookups down to leaf pages containing slotted tuple arrays and sibling pointers.
Internal Root Page #0: Contains pivot key values 20 and 40. Internal nodes guide range searches down to appropriate leaf pages. If a leaf node exceeds 4 KB during insertion, a split occurs and a new pivot key is promoted to the root.
2. MVCC & Transaction Visibility
Each tuple payload includes xmin and xmax transaction header flags. Under Read Committed isolation, transactions see committed tuples with xmin ≤ TxID and xmax uncommitted or > TxID.
Allocates TxID = 101
Creates row tuple with xmin = 101, xmax = 0. Uncommitted!
Appends COMMIT record to WAL & fsyncs. Row is now visible globally!
Allocates TxID = 102
xmin has committed prior to Transaction B snapshot evaluation. Uncommitted writes from Transaction A remain isolated. Non-repeatable reads are allowed by Read Committed design scope.3. Volcano Query Executor Pipeline
SQL queries pass from raw text through the Lexer, Parser, AST planner, and Volcano physical iterator tree.
User submits raw string query: SELECT * FROM users WHERE age >= 25;