Skip to content

Commit 9ad00a8

Browse files
committed
docs: fix tiered compaction examples
Signed-off-by: Alex Chi <[email protected]>
1 parent 1c39ee8 commit 9ad00a8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ The current trigger only reduces space amplification. We will need to add new tr
153153

154154
The next trigger is the size ratio trigger. The trigger maintains the size ratio between the tiers. From the first tier, we compute the size of `this tier / sum of all previous tiers`. For the first encountered tier where this value `> (100 + size_ratio) * 1%`, we will compact all previous tiers excluding the current tier. We only do this compaction with there are more than `min_merge_width` tiers to be merged.
155155

156-
For example, given the following LSM state, and assume size_ratio = 1, we should compact when the ratio value > 101%:
156+
For example, given the following LSM state, and assume size_ratio = 1, and min_merge_width = 2. We should compact when the ratio value > 101%:
157157

158158
```
159159
Tier 3: 1
@@ -166,19 +166,20 @@ Example 2:
166166
```
167167
Tier 3: 1
168168
Tier 2: 1 ; 1 / 1 = 1
169-
Tier 1: 3 ; 3 / (1 + 1) = 1.5, compact tier 1+2+3
169+
Tier 1: 3 ; 3 / (1 + 1) = 1.5, compact tier 2+3
170170
```
171171

172172
```
173-
Tier 4: 5
173+
Tier 4: 2
174+
Tier 1: 3
174175
```
175176

176177
Example 3:
177178

178179
```
179180
Tier 3: 1
180-
Tier 2: 2 ; 2 / 1 = 2, compact tier 2+3
181-
Tier 1: 4
181+
Tier 2: 2 ; 2 / 1 = 2, however, it does not make sense to compact only one tier; also note that min_merge_width=2
182+
Tier 1: 4 ; 4 / 3 = 1.33, compact tier 2+3
182183
```
183184

184185
```

0 commit comments

Comments
 (0)