https://github.com/ashwaniydv/my-lsm-tree-cpp
Log-structured Key-Value storage engine written in C++
https://github.com/ashwaniydv/my-lsm-tree-cpp
bitcask cpp database db storage-engine wal write-ahead-logging
Last synced: about 1 year ago
JSON representation
Log-structured Key-Value storage engine written in C++
- Host: GitHub
- URL: https://github.com/ashwaniydv/my-lsm-tree-cpp
- Owner: ashwaniYDV
- License: mit
- Created: 2024-02-03T12:08:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-01T12:26:07.000Z (about 2 years ago)
- Last Synced: 2025-04-02T21:42:34.668Z (about 1 year ago)
- Topics: bitcask, cpp, database, db, storage-engine, wal, write-ahead-logging
- Language: C++
- Homepage:
- Size: 2.01 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# My-LSM-Tree-cpp
* Implemented a Log-Structured Merge Tree (LSM Tree) Key-Value Storage Engine in C++, drawing inspiration from databases like Bitcask, LevelDB, RocskDB, etc.
## About
* Lightning-fast writes by appending data directly to a binary file, optimizing write performance.
* Reads are highly efficient, leveraging an in-memory index to store byte offsets of the latest records in the data file.
* It is fault-tolerant, persisting both data and index to the file system.
* Supports crash recovery through "write-ahead logging," allowing the reconstruction of the index in case of system crashes during the persistence process.
* Data is stored across multiple immutable files + one active/mutable file for handling large data.
## TODO
* Write a compaction algorithm (running in background) to merge older chunks and their indexes. (Since data file is append only, a key can be present in multiple files but its latest record will be in one of the latest files.)
* Implement LSM tree.
## How to run
```
make clean
make run
```
## References
* https://riak.com/assets/bitcask-intro.pdf