- Reading material : https://github.com/dashjay/mini-lsm-go/tree/main
curl -v -XPOST http://localhost:8080/api/v1/set/:key -d 'value'
curl -v http://localhost:8080/api/v1/get/:key
curl -v http://localhost:8080/api/v1/flush
flush memory data to disk table and delete wal log.
- command -> memory SSTable -> WAL
- memory SSTable -> swich SSTable to immutable
- flush immutable to sdb
- delete WAL
- query -> memory SSTable -> active SSTable -> immutable SSTable -> sparse Index -> sdb file
N | N | N | 40 | |
---|---|---|---|---|
blockLength, blockData | ... | blockLength, blockData | sparse index | metainfo |
4 | 4 | N |
---|---|---|
index.start | keyLength | index.key |
8 | 8 | 8 | 8 | 2 | 2 | 4 |
---|---|---|---|---|---|---|
dataStart | dataLength | indexStart | indexLength | blockKeyNum | tableBlockNum | version |
4 | N | 4 | N | 4 | N | |
---|---|---|---|---|---|---|
commandLength | command | commandLength | command | ... | commandLength | command |
1 | 4 | N | 4 | N |
---|---|---|---|---|
commandType | keyLength | key | valueLength | value |
- block data use LZ4 compressed
- wal log is not compressed
- memory SSTable
- disk SSTable
- WAL
- memory flush to disk
- memory SSTable use skiplist
- L0 data has repeat key, need read latest key
- disk SSTable compaction: Tiering compaction / Leveling compaction
- use bitmap to improve performance