diff --git a/mini-lsm-book/src/week2-03-tiered.md b/mini-lsm-book/src/week2-03-tiered.md index 19fab38..4bbadc0 100644 --- a/mini-lsm-book/src/week2-03-tiered.md +++ b/mini-lsm-book/src/week2-03-tiered.md @@ -153,7 +153,7 @@ The current trigger only reduces space amplification. We will need to add new tr 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. -For example, given the following LSM state, and assume size_ratio = 1, we should compact when the ratio value > 101%: +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%: ``` Tier 3: 1 @@ -166,19 +166,20 @@ Example 2: ``` Tier 3: 1 Tier 2: 1 ; 1 / 1 = 1 -Tier 1: 3 ; 3 / (1 + 1) = 1.5, compact tier 1+2+3 +Tier 1: 3 ; 3 / (1 + 1) = 1.5, compact tier 2+3 ``` ``` -Tier 4: 5 +Tier 4: 2 +Tier 1: 3 ``` Example 3: ``` Tier 3: 1 -Tier 2: 2 ; 2 / 1 = 2, compact tier 2+3 -Tier 1: 4 +Tier 2: 2 ; 2 / 1 = 2, however, it does not make sense to compact only one tier; also note that min_merge_width=2 +Tier 1: 4 ; 4 / 3 = 1.33, compact tier 2+3 ``` ```