2024-01-28 18:24:41 +08:00
|
|
|
# Snapshot Read - Memtables and Timestamps
|
2024-01-28 14:08:08 +08:00
|
|
|
|
|
|
|
|
During the refactor, you might need to change the signature of some functions from `&self` to `self: &Arc<Self>` as necessary.
|
2024-01-28 15:17:53 +08:00
|
|
|
|
2024-01-28 16:01:40 +08:00
|
|
|
## Task 1: MemTable, Write-Ahead Log, and Read Path
|
2024-01-28 15:17:53 +08:00
|
|
|
|
2024-01-28 16:01:40 +08:00
|
|
|
Memtable store timestamp, change to scan, encode ts in wal
|
|
|
|
|
|
|
|
|
|
## Task 2: Write Path
|
|
|
|
|
|
|
|
|
|
assign mvcc object, take write lock, increase ts by 1
|
|
|
|
|
|
|
|
|
|
## Task 3: MVCC Compaction
|
|
|
|
|
|
2024-01-28 16:20:01 +08:00
|
|
|
keep all versions, split file, run merge iterator tests
|
2024-01-28 16:01:40 +08:00
|
|
|
|
|
|
|
|
## Task 4: LSM Iterator
|
|
|
|
|
|
|
|
|
|
return the latest version
|
2024-01-28 16:20:01 +08:00
|
|
|
|
|
|
|
|
pass all tests except week 2 day 6
|
2024-01-28 18:08:23 +08:00
|
|
|
|
|
|
|
|
## Test Your Understanding
|
|
|
|
|
|
|
|
|
|
* What is the difference of `get` in the MVCC engine and the engine you built in week 2?
|
|
|
|
|
* In week 2, you stop at the first memtable/level where a key is found when `get`. Can you do the same in the MVCC version?
|
2024-01-28 18:21:52 +08:00
|
|
|
|
|
|
|
|
We do not provide reference answers to the questions, and feel free to discuss about them in the Discord community.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{{#include copyright.md}}
|