A educational-purpose relational database management system (RDBMS) built from scratch in Rust. It features a SQL parser, a transactional Write-Ahead Log (WAL), a volcano-style execution engine, and persistent storage using JSON for metadata and CSV for data.
- SQL Support: Implements DDL (
CREATE TABLE) and DML (SELECT,INSERT,UPDATE,DELETE). - Transactional Integrity: Supports
BEGIN,COMMIT, andROLLBACKwith a dedicated WAL (Write-Ahead Logging) for crash recovery. - Volcano Execution Model: Query execution via a tree of physical operators (Scan, Filter, Project, Aggregate).
- Persistent Metadata: Automatic schema discovery from disk using
.schema.jsonfiles. - Graceful Shutdown: Checkpointing system to flush memory state to CSV and truncate logs.
The engine is divided into several modular components:
- Lexer & Parser: Converts raw SQL strings into an Abstract Syntax Tree (AST).
- Database Engine: Manages the life-cycle of transactions and the mapping of in-memory tables.
- Executor: Binds logical AST nodes to physical operators and handles type checking.
- Storage Layer: Handles Row-based storage and CSV/JSON serialization.
- WAL: Ensures Atomicity and Durability by logging operations before applying them to memory.
Ensure you have Rust installed.
git clone https://github.com/tannal/tjdb.git
cd tjdb
cargo build- Join operator
- MVCC
- testing infrastructure
[4字节长度] + [8字节LSN] + [4字节Checksum] + [1字节Op类型] + [Payload]