From 1de588668c7161227256440ad77dcd7182d9e827 Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 21 Sep 2021 11:25:41 -0700 Subject: [PATCH] Fix flaky ldb_cmd_test tests caused by file deletions during validation (#8942) Summary: In FileChecksumTestHelper::VerifyEachFileChecksum(), we query the file list, and then for each file in the list verify the checksum. However, compaction can delete those files in the mean time and cause failures. To prevent it from happening, disable file deletion during the validation. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8942 Test Plan: Run exsiting test and see it doesn't fail. Reviewed By: pdillinger Differential Revision: D31086488 fbshipit-source-id: 554608f36d2dd3bf0a20dfc4039c68bd8533d7f8 --- tools/ldb_cmd_test.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/ldb_cmd_test.cc b/tools/ldb_cmd_test.cc index fc1a6fe8a..90cd08a8a 100644 --- a/tools/ldb_cmd_test.cc +++ b/tools/ldb_cmd_test.cc @@ -254,15 +254,18 @@ class FileChecksumTestHelper { // comparing it with the one being generated when a SST file is created. Status VerifyEachFileChecksum() { assert(db_ != nullptr); + EXPECT_OK(db_->DisableFileDeletions()); std::vector live_files; db_->GetLiveFilesMetaData(&live_files); + Status cs; for (auto a_file : live_files) { - Status cs = VerifyChecksum(a_file); + cs = VerifyChecksum(a_file); if (!cs.ok()) { - return cs; + break; } } - return Status::OK(); + EXPECT_OK(db_->EnableFileDeletions()); + return cs; } };