From 4a9ae4f71379d643a8e22b353a274f36b7914b72 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Tue, 8 Mar 2022 08:36:25 -0800 Subject: [PATCH] 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 --- db_stress_tool/db_stress_test_base.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index 3ad358876..c30a069ec 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -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 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