Skip to content

Commit 9b19f17

Browse files
committed
add intro of 2.3 2.4
Signed-off-by: Alex Chi Z <iskyzh@gmail.com>
1 parent 1c23d43 commit 9b19f17

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

mini-lsm-book/src/week2-03-tiered.md

+4
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ The tiered compaction we talk about in this chapter is the same as RocksDB's uni
1111

1212
## Task 1: Universal Compaction
1313

14+
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.
15+
1416
### Task 1.1: Triggered by Space Amplification Ratio
1517

1618
### Task 1.2: Triggered by Size Ratio
1719

1820
### Task 1.3: Reduce Sorted Runs
1921

22+
**Note: we do not provide fine-grained unit tests for this part. You can run the compaction simulator and compare with the output of the reference solution to see if your implementation is correct.**
23+
2024
## Task 2: Integrate with the Read Path
2125

2226
As tiered compaction does not use the L0 level of the LSM state, you should directly flush your memtables to a new tier instead of as an L0 SST. You can use `self.compaction_controller.flush_to_l0()` to know whether to flush to L0. You may use the first output SST id as the level/tier id for your new sorted run.

mini-lsm-book/src/week2-04-leveled.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@ In this chapter, you will:
99

1010
## Task 1: Leveled Compaction
1111

12+
In chapter 2 day 2, you have implemented the simple leveled compaction strategies. However, the implementation has a few problems:
13+
14+
* Compaction always include a full level. Note that you cannot remove the old files until you finish the compaction, and therefore, your storage engine might use 2x storage space while the compaction is going on (if it is a full compaction). Tiered compaction has the same problem. In this chapter, we will implement partial compaction that we select one SST from the upper level for compaction, instead of the full level.
15+
* SSTs may be compacted across empty levels. As you have seen in the compaction simulator, when the LSM state is empty, and the engine flushes some L0 SSTs, these SSTs will be first compacted to L1, then from L1 to L2, etc. An optimal strategy is to directly place the SST from L0 to the lowest level possible, so as to avoid unnecessary write amplification.
16+
17+
In this chapter, you will implement a production-ready leveled compaction strategy. The strategy is the same as RocksDB's leveled compaction.
18+
1219
### Task 1.1: Compute Target Sizes
1320

1421
### Task 1.2: Decide Base Level
1522

1623
### Task 1.3: Decide Level Priorities
1724

18-
## Task 2: Compaction Simulation
25+
**Note: we do not provide fine-grained unit tests for this part. You can run the compaction simulator and compare with the output of the reference solution to see if your implementation is correct.**
1926

20-
## Task 3: Integrate with the Read Path
27+
## Task 2: Integrate with the Read Path
2128

2229
## Test Your Understanding
2330

mini-lsm-book/src/week2-05-manifest.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ In this chapter, you will:
1111

1212
## Task 2: Write Manifests
1313

14-
## Task 3: Recover from the State
14+
## Task 3: Flush on Close
15+
16+
## Task 4: Recover from the State
1517

1618
{{#include copyright.md}}

0 commit comments

Comments
 (0)