n-ozerov commented :
Well, i tried to think by myself and i realized how we can improve compactions:
-
We have Flatten function which brings all tables\keys\versions to same level. We apply that function.
-
We iterate through whole db and decide which sst tables we can delete immediately (all keys are tombstoned) as whole files.
-
We merge tables within same level (of course if it technically possible) where ranges of tombstones exceeded threshold (number or percent).
-
Then change level number to highest possible which fits into max level size.
Example:
Level: 0. 0 B Size. 0 B Max.
Level: 1. 0 B Size. 268 MB Max.
Level: 2. 233 MB Size. 2.7 GB Max.
Turns into:
Level: 0. 0 B Size. 0 B Max.
Level: 1. 233 MB Size. 268 MB Max.
Level: 2. 0 B Size. 2.7 GB Max.
Can we?
- In the end we should have the most compacted tree at the highest possible level.