• Andrew Kryczka's avatar
    fix live WALs purged while file deletions disabled · 46e599fc
    Andrew Kryczka authored
    When calling `DisableFileDeletions` followed by `GetSortedWalFiles`, we guarantee the files returned by the latter call won't be deleted until after file deletions are re-enabled. However, `GetSortedWalFiles` didn't omit files already planned for deletion via `PurgeObsoleteFiles`, so the guarantee could be broken.
    We fix it by making `GetSortedWalFiles` wait for the number of pending purges to hit zero if file deletions are disabled. This condition is eventually met since `PurgeObsoleteFiles` is guaranteed to be called for the existing pending purges, and new purges cannot be scheduled while file deletions are disabled. Once the condition is met, `GetSortedWalFiles` simply returns the content of DB and archive directories, which nobody can delete (except for deletion scheduler, for which I plan to fix this bug later) until deletions are re-enabled.
    Closes https://github.com/facebook/rocksdb/pull/3341
    Differential Revision: D6681131
    Pulled By: ajkr
    fbshipit-source-id: 90b1e2f2362ea9ef715623841c0826611a817634