MagnumDB Engine
Deep-Dive Specification

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.

Engine Topology

Architecture Overview

Explore Full Architecture Specifications
Application / Client (psql or Rust binary)
MagnumDB API & Postgres Protocol Server
KV Engine
Key-Value API Interface
SQL Engine
Parser & Volcano Executor
B+ Tree Index & MVCC Tuple Storage
LRU Buffer Pool Manager & 4 KB Pager
Write-Ahead Logging (WAL + fsync)
Primary Data Files & WAL Log on Disk

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.

Interactive B+ Tree Storage Visualizer
Page Size: 4096 Bytes (4 KB)
Ptr < 20
20 ≤ Ptr < 40
Ptr ≥ 40
Page Inspector Details

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.

MVCC Concurrent Transaction Visualizer
Isolation:Read Committed
Timeline Step:1 / 4
Transaction A (Writer)TxID: 101
BEGIN;

Allocates TxID = 101

INSERT INTO accounts VALUES (1, 500);

Creates row tuple with xmin = 101, xmax = 0. Uncommitted!

COMMIT;

Appends COMMIT record to WAL & fsyncs. Row is now visible globally!

Transaction B (Reader)TxID: 102
BEGIN;

Allocates TxID = 102

SELECT * FROM accounts WHERE id = 1;
Read Committed Guarantee: Transaction B can only view rows where 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.

Volcano SQL Query Execution Pipeline
Click step to inspect engine layer
Layer Inspection: 1. SQL Query Input

User submits raw string query: SELECT * FROM users WHERE age >= 25;