Avoid .trash handling race in db_stress Checkpoint (#9673)

Summary:
The shared SstFileManager in db_stress can create background
work that races with TestCheckpoint such that DestroyDir fails because
of file rename while it is running. Analogous to change already made
for TestBackupRestore

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

Test Plan:
make blackbox_crash_test for a while with
checkpoint_one_in=100

Reviewed By: ajkr

Differential Revision: D34702215

Pulled By: pdillinger

fbshipit-source-id: ac3e166efa28cba6c6f4b9b391e799394603ebfd
This commit is contained in:
Peter Dillinger 2022-03-08 08:36:25 -08:00 committed by Facebook GitHub Bot
parent 36aec94d85
commit 4a9ae4f713

View File

@ -1744,6 +1744,8 @@ Status StressTest::TestCheckpoint(ThreadState* thread,
if (s.ok()) {
Options options(options_);
options.listeners.clear();
// Avoid race condition in trash handling after delete checkpoint_db
options.sst_file_manager.reset();
std::vector<ColumnFamilyDescriptor> cf_descs;
// TODO(ajkr): `column_family_names_` is not safe to access here when
// `clear_column_family_one_in != 0`. But we can't easily switch to