From f4a1d106681c7631db9d3932331e6433dd12b548 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Wed, 15 Sep 2021 21:30:23 -0700 Subject: [PATCH] Fix flaky WALTrashCleanupOnOpen (#8917) Summary: Test did not consider that slower deletion rate only kicks in after a file is deleted Fixes https://github.com/facebook/rocksdb/issues/7546 Pull Request resolved: https://github.com/facebook/rocksdb/pull/8917 Test Plan: no longer reproduces using buck test mode/dev //internal_repo_rocksdb/repo:db_sst_test -- --exact 'internal_repo_rocksdb/repo:db_sst_test - DBWALTestWithParam/DBWALTestWithParam.WALTrashCleanupOnOpen/0' --jobs 40 --stress-runs 600 --record-results Reviewed By: siying Differential Revision: D30949127 Pulled By: pdillinger fbshipit-source-id: 5d0607f8f548071b07410fe8f532b4618cd225e5 --- db/db_sst_test.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/db_sst_test.cc b/db/db_sst_test.cc index 71c94bf49..15596d494 100644 --- a/db/db_sst_test.cc +++ b/db/db_sst_test.cc @@ -809,9 +809,11 @@ TEST_P(DBWALTestWithParam, WALTrashCleanupOnOpen) { // Create 4 files in L0 for (char v = 'a'; v <= 'd'; v++) { - if (v == 'd') { + if (v == 'c') { // Maximize the change that the last log file will be preserved in trash // before restarting the DB. + // We have to set this on the 2nd to last file for it to delay deletion + // on the last file. (Quirk of DeleteScheduler::BackgroundEmptyTrash()) options.sst_file_manager->SetDeleteRateBytesPerSecond(1); } ASSERT_OK(Put("Key2", DummyString(1024, v)));