Skip to content

Commit

Permalink
ensure compaction can finish in mvcc
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi <[email protected]>
  • Loading branch information
skyzh committed Jan 25, 2024
1 parent 63429b5 commit 595016f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ We are working on chapter 3 and more test cases for all existing contents.
* Week 3: Multi-Version Concurrency Control
* The Extra Week / Rest of Your Life: Optimizations (unlikely to be available in 2024...)

✅: finished \
✅: Finished \
🚧: WIP and will likely be available soon

| Week + Chapter | Topic | Solution | Starter Code | Writeup |
| -------------- | ----------------------------------------------- | -------- | ------------ | ------- |
| 2.7 | Batch Write + Checksum | 🚧 | 🚧 | |
| 3.1 | Timestamp Key Encoding | 🚧 | | |
| 3.2 | Snapshot Read - Blocks, Memtables, and SSTs | | | |
| 3.3 | Snapshot Read - Engine Read Path | | | |
| 3.4 | Watermark and Garbage Collection | | | |
| 2.7 | Batch Write + Checksum | | | |
| 3.1 | Timestamp Key Encoding | | 🚧 | |
| 3.2 | Snapshot Read - Blocks, Memtables, and SSTs | | 🚧 | |
| 3.3 | Snapshot Read - Engine Read Path | 🚧 | 🚧 | |
| 3.4 | Watermark and Garbage Collection | 🚧 | 🚧 | |
| 3.5 | Transactions and Optimistic Concurrency Control | | | |
| 3.6 | Serializable Snapshot Isolation | | | |
| 3.7 | TTL (Time-to-Live) Entries | | | |
Expand Down
2 changes: 1 addition & 1 deletion mini-lsm-mvcc/src/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ impl LsmStorageInner {
}

fn trigger_compaction(&self) -> Result<()> {
self.dump_structure();
let snapshot = {
let state = self.state.read();
state.clone()
Expand All @@ -318,6 +317,7 @@ impl LsmStorageInner {
let Some(task) = task else {
return Ok(());
};
self.dump_structure();
println!("running compaction task: {:?}", task);
let sstables = self.compact(&task)?;
let output = sstables.iter().map(|x| x.sst_id()).collect::<Vec<_>>();
Expand Down
2 changes: 1 addition & 1 deletion mini-lsm/src/tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub fn compaction_bench(storage: Arc<MiniLsm>) {
let mut max_key = 0;
for iter in 0..10 {
let range_begin = iter * 5000;
for i in range_begin..(range_begin + 40000) {
for i in range_begin..(range_begin + 10000) {
// 120B per key, 4MB data populated
let key = gen_key(i);
let version = key_map.get(&i).copied().unwrap_or_default() + 1;
Expand Down

0 comments on commit 595016f

Please sign in to comment.