From 9057d0a0795324443b6c171d62c31ee5bf42fc8d Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 22 Dec 2020 14:42:06 -0800 Subject: [PATCH] Minimize Timing Issue in test WALTrashCleanupOnOpen (#7796) Summary: We saw DBWALTestWithParam/DBWALTestWithParam.WALTrashCleanupOnOpen sometimes fail with: db/db_sst_test.cc:575: Failure Expected: (trash_log_count) >= (1), actual: 0 vs 1 The suspicious is that delete scheduling actually deleted all trash files based on rate, but it is not expected. This can be reproduced if we manually add sleep after DB is closed for serveral seconds. Minimize its chance by setting the delete rate to be lowest possible. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7796 Test Plan: The test doesn't fail with the manual sleeping anymore Reviewed By: anand1976 Differential Revision: D25675000 fbshipit-source-id: a39fd05e1a83719c41014e48843792e752368e22 --- db/db_sst_test.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db/db_sst_test.cc b/db/db_sst_test.cc index 3ccb57baa..fbf6feb0e 100644 --- a/db/db_sst_test.cc +++ b/db/db_sst_test.cc @@ -544,6 +544,11 @@ TEST_P(DBWALTestWithParam, WALTrashCleanupOnOpen) { // Create 4 files in L0 for (char v = 'a'; v <= 'd'; v++) { + if (v == 'd') { + // Maximize the change that the last log file will be preserved in trash + // before restarting the DB. + options.sst_file_manager->SetDeleteRateBytesPerSecond(1); + } ASSERT_OK(Put("Key2", DummyString(1024, v))); ASSERT_OK(Put("Key3", DummyString(1024, v))); ASSERT_OK(Put("Key4", DummyString(1024, v)));