Skip to content

mermoldy/mysqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mysqlite

A playground for learning database stuff.

The goal of this project is to build a toy SQLite clone by following the tutorial https://cstack.github.io/db_tutorial (C -> Rust) with MVCC and Client-Server architecture.

Design

The internal architecture follows SQLite’s design:

Storage

The mysqlite storage backend is organized similarly to InnoDB. Each table has its own tablespace file (.tbd), which contains a tablespace header and a sequence of fixed-size pages. Each page includes a header and a data section that stores rows. Pages are organized as B-tree nodes. The B-tree implementation is SQLite-like and follows this tutorial.

Each B-tree consists of multiple nodes, with each node being one page in size. The B-tree can load a page from disk or write it back by issuing commands to the pager. There are two types of nodes: leaf nodes, which store rows, and internal nodes, which store the B-tree structure.

The pager handles reading and writing pages at specific file offsets. It also maintains an in-memory cache of recently accessed pages and decides when to flush them to disk.

About

A playground for learning database stuff.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages