From a5c61760b09978e40f5725010ea69d113e502980 Mon Sep 17 00:00:00 2001 From: Alex Chi Date: Wed, 21 Feb 2024 21:06:02 -0500 Subject: [PATCH] add backlink to comapction overview Signed-off-by: Alex Chi --- mini-lsm-book/src/week2-01-compaction.md | 6 ++++++ mini-lsm-book/src/week2-02-simple.md | 6 ++++++ mini-lsm-book/src/week2-03-tiered.md | 8 +++++++- mini-lsm-book/src/week2-04-leveled.md | 6 ++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mini-lsm-book/src/week2-01-compaction.md b/mini-lsm-book/src/week2-01-compaction.md index 74ed2a4..c8bc8d6 100644 --- a/mini-lsm-book/src/week2-01-compaction.md +++ b/mini-lsm-book/src/week2-01-compaction.md @@ -15,6 +15,12 @@ cargo x copy-test --week 2 --day 1 cargo x scheck ``` +
+ +It might be helpful to take a look at [week 2 overview](./week2-overview.md) before reading this chapter to have a general overview of compactions. + +
+ ## Task 1: Compaction Implementation In this task, you will implement the core logic of doing a compaction -- merge sort a set of SST files into a sorted run. You will need to modify: diff --git a/mini-lsm-book/src/week2-02-simple.md b/mini-lsm-book/src/week2-02-simple.md index 1921259..dbf8770 100644 --- a/mini-lsm-book/src/week2-02-simple.md +++ b/mini-lsm-book/src/week2-02-simple.md @@ -14,6 +14,12 @@ cargo x copy-test --week 2 --day 2 cargo x scheck ``` +
+ +It might be helpful to take a look at [week 2 overview](./week2-overview.md) before reading this chapter to have a general overview of compactions. + +
+ ## Task 1: Simple Leveled Compaction In this chapter, we are going to implement our first compaction strategy -- simple leveled compaction. In this task, you will need to modify: diff --git a/mini-lsm-book/src/week2-03-tiered.md b/mini-lsm-book/src/week2-03-tiered.md index 98fe2b8..b5b619e 100644 --- a/mini-lsm-book/src/week2-03-tiered.md +++ b/mini-lsm-book/src/week2-03-tiered.md @@ -16,6 +16,12 @@ cargo x copy-test --week 2 --day 3 cargo x scheck ``` +
+ +It might be helpful to take a look at [week 2 overview](./week2-overview.md) before reading this chapter to have a general overview of compactions. + +
+ ## Task 1: Universal Compaction In this chapter, you will implement RocksDB's universal compaction, which is of the tiered compaction family compaction strategies. Similar to the simple leveled compaction strategy, we only use number of files as the indicator in this compaction strategy. And when we trigger the compaction jobs, we always include a full sorted run (tier) in the compaction job. @@ -28,7 +34,7 @@ In this task, you will need to modify: src/compact/tiered.rs ``` -In universal compaction, we do not use L0 SSTs in the LSM state. Instead, we directly flush new SSTs to a single sorted run (called tier). In the LSM state, `levels` will now include all tiers, where the lowest index is the latest SST flushed. The compaction simulator generates tier id based on the first SST id, and you should do the same in your implementation. +In universal compaction, we do not use L0 SSTs in the LSM state. Instead, we directly flush new SSTs to a single sorted run (called tier). In the LSM state, `levels` will now include all tiers, where **the lowest index is the latest SST flushed**. Each element in the `levels` vector stores a tuple: level ID (used as tier ID) and the SSTs in that level. Every time you flush L0 SSTs, you should flush the SST into a tier placed at the front of the vector. The compaction simulator generates tier id based on the first SST id, and you should do the same in your implementation. Universal compaction will only trigger tasks when the number of tiers (sorted runs) is larger than `num_tiers`. Otherwise, it does not trigger any compaction. diff --git a/mini-lsm-book/src/week2-04-leveled.md b/mini-lsm-book/src/week2-04-leveled.md index cbf629b..08502db 100644 --- a/mini-lsm-book/src/week2-04-leveled.md +++ b/mini-lsm-book/src/week2-04-leveled.md @@ -14,6 +14,12 @@ cargo x copy-test --week 2 --day 4 cargo x scheck ``` +
+ +It might be helpful to take a look at [week 2 overview](./week2-overview.md) before reading this chapter to have a general overview of compactions. + +
+ ## Task 1: Leveled Compaction In chapter 2 day 2, you have implemented the simple leveled compaction strategies. However, the implementation has a few problems: