Fix assertion that compaction input files are freeed (#13109)

Summary:
This assertion could fail if the compaction input files were successfully trivially moved. On re-locking db mutex after successful `LogAndApply`, those files could have been picked up again by some other compactions. And the assertion will fail.

Example failure: P1669529213

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13109

Reviewed By: cbi42

Differential Revision: D65308574

Pulled By: jowlyzhang

fbshipit-source-id: 32413bdc8e28e67a0386c3fe6327bf0b302b9d1d
This commit is contained in:
Yu Zhang 2024-11-05 09:39:54 -08:00 committed by Facebook GitHub Bot
parent a7ecbfd590
commit 8089eae240
1 changed files with 4 additions and 1 deletions

View File

@ -3986,7 +3986,10 @@ Status DBImpl::BackgroundCompaction(bool* made_progress,
// Sanity checking that compaction files are freed. // Sanity checking that compaction files are freed.
for (size_t i = 0; i < c->num_input_levels(); i++) { for (size_t i = 0; i < c->num_input_levels(); i++) {
for (size_t j = 0; j < c->inputs(i)->size(); j++) { for (size_t j = 0; j < c->inputs(i)->size(); j++) {
assert(!c->input(i, j)->being_compacted); // When status is not OK, compaction's result installation failed and
// no new Version installed. The files could have been released and
// picked up again by other compaction attempts.
assert(!c->input(i, j)->being_compacted || !status.ok());
} }
} }
std::unordered_set<Compaction*>* cip = c->column_family_data() std::unordered_set<Compaction*>* cip = c->column_family_data()