This project was developed as part of the Database Internals module to explore and implement eventual durability in a custom-built database. Our team built a lightweight SQL database from scratch in Java, named MiniSQL, and incorporated an experimental durability model inspired by cutting-edge database research.
Our core idea: Decouple commit from durability to improve throughput for specific transaction types. This allows users to choose between FAST (eventually durable) and SAFE (strongly durable) transactions.
- β
SQL Parser with support for:
CREATE,INSERT,UPDATE,DELETE,SELECT
- π§ Write-Ahead Logging (WAL)
- π Page-based storage engine
- ποΈ LRU buffer pool for in-memory page management
- πΎ Durable and Eventually Durable transaction models
- π‘ Support for hints:
/*+ FAST */vs/*+ SAFE */ - π Performance benchmark suite for write-intensive workloads
- Interactive shell to execute SQL queries
- Handles user inputs and recovery
- Initiates safe shutdown procedures
- Page abstraction for on-disk data
- LRU buffer pool management
- Write-Ahead Log (WAL) for recovery
- FAST Transactions: Commit instantly without flushing WAL
- SAFE Transactions: Commit only after WAL + page flush
- WAL flushing is handled by a background thread for FAST transactions
To test eventual durability:
/*+ FAST */
UPDATE kv SET v = v + 1 WHERE k = <random_key>;/*+ SAFE */
UPDATE kv SET v = v + 1 WHERE k = <random_key>;We evaluated performance using:
- π§΅ 8 parallel threads
- ποΈ 256-row preloaded key-value table
- β±οΈ 5-second write-intensive workload
Metrics Collected:
- β Transactions committed
- β±οΈ Latency (Β΅s)
- π Throughput (txns/sec)
- Java 11 or higher
- Maven (for build and dependency management)
git clone https://github.com/RadCod3/customdb.git
cd customdb
mvn clean compile exec:javaCREATE TABLE kv (k INT PRIMARY KEY, v INT);
INSERT INTO kv VALUES (1, 100);
UPDATE kv SET v = v + 1 WHERE k = 1; /*+ FAST */We also implemented a similar eventual durability mechanism in a fork of MySQL 8.0.36: