Some good strategies to implement

n-ozerov commented :

Well, i tried to think by myself and i realized how we can improve compactions:

  1. We have Flatten function which brings all tables\keys\versions to same level. We apply that function.

  2. We iterate through whole db and decide which sst tables we can delete immediately (all keys are tombstoned) as whole files.

  3. We merge tables within same level (of course if it technically possible) where ranges of tombstones exceeded threshold (number or percent).

  4. 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?

  1. In the end we should have the most compacted tree at the highest possible level.