• L
    Clean up blob files based on the linked SST set (#7001) · e367bc7f
    Levi Tamasi 提交于
    Summary:
    The earlier `VersionBuilder` code only cleaned up blob files that were
    marked as entirely consisting of garbage using `VersionEdits` with
    `BlobFileGarbage`. This covers the cases when table files go through
    regular compaction, where we iterate through the KVs and thus have an
    opportunity to calculate the amount of garbage (that is, most cases).
    However, it does not help when table files are simply dropped (e.g. deletion
    compactions or the `DeleteFile` API). To deal with such cases, the patch
    adds logic that cleans up all blob files at the head of the list until the first
    one with linked SSTs is found. (As an example, let's assume we have blob files
    with numbers 1..10, and the first one with any linked SSTs is number 8.
    This means that SSTs in the `Version` only rely on blob files with numbers >= 8,
    and thus 1..7 are no longer needed.)
    
    The code change itself is pretty small; however, changing the logic like this
    necessitated changes to some tests that have been added recently (namely
    to the ones that use blob files in isolation, i.e. without any table files referring
    to them). Some of these cases were fixed by bypassing `VersionBuilder` altogether
    in order to keep the tests simple (which actually makes them more proper unit tests
    as well), while the `VersionBuilder` unit tests were fixed by adding dummy table
    files to the test cases as needed.
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/7001
    
    Test Plan: `make check`
    
    Reviewed By: riversand963
    
    Differential Revision: D22119474
    
    Pulled By: ltamasi
    
    fbshipit-source-id: c6547141355667d4291d9661d6518eb741e7b54a
    e367bc7f
db_test.cc 223.6 KB