goleveldb
goleveldb copied to clipboard
leveldb: reduce compaction table set of target level
During table compaction, tables in source & target level are simply merged together and output to new tables. That's fine for a testing-purpose random dataset. But for a real case, sometimes none of keys in source level falls within some target level tables(L0->L1, especially) . Then these target level tables can be skipped.
This PR implements this feature.
Grepping the db log of my project with 'reducing' shows
16:07:47.800017 table@compaction reducing L0 -> L1 F·-27 S·-86MiB
16:07:57.902166 table@compaction reducing L0 -> L1 F·-7 S·-28MiB
16:08:18.274260 table@compaction reducing L2 -> L3 F·-2 S·-819B
16:08:19.743393 table@compaction reducing L2 -> L3 F·-4 S·-10KiB
16:08:20.480615 table@compaction reducing L2 -> L3 F·-3 S·-1MiB