Attempt to deflake ObsoleteFilesTest.DeleteObsoleteOptionsFile (#8624)

Summary:
We've been seeing occasional crashes on CI while inserting into the
vectors in `ObsoleteFilesTest.DeleteObsoleteOptionsFile`. The crashes
don't reproduce locally (could be either a race or an object lifecycle
issue) but the good news is that the vectors in question are not really
used for anything meaningful by the test. (The assertion about the sizes
of the two vectors being equal is guaranteed to hold, since the two sync
points where they are populated are right after each other.) The patch
simply removes the vectors from the test, alongside the associated
callbacks and sync points.

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

Test Plan: `make check`

Reviewed By: akankshamahajan15

Differential Revision: D30118485

Pulled By: ltamasi

fbshipit-source-id: 0a4c3d06584e84cd2b1dcc212d274fa1b89cb647
main
Levi Tamasi 3 years ago committed by Facebook GitHub Bot
parent b01a428d9b
commit 9b25d26dc8
  1. 6
      db/db_impl/db_impl_files.cc
  2. 13
      db/obsolete_files_test.cc

@ -524,12 +524,6 @@ void DBImpl::PurgeObsoleteFiles(JobContext& state, bool schedule_only) {
break; break;
case kOptionsFile: case kOptionsFile:
keep = (number >= optsfile_num2); keep = (number >= optsfile_num2);
TEST_SYNC_POINT_CALLBACK(
"DBImpl::PurgeObsoleteFiles:CheckOptionsFiles:1",
reinterpret_cast<void*>(&number));
TEST_SYNC_POINT_CALLBACK(
"DBImpl::PurgeObsoleteFiles:CheckOptionsFiles:2",
reinterpret_cast<void*>(&keep));
break; break;
case kCurrentFile: case kCurrentFile:
case kDBLockFile: case kDBLockFile:

@ -149,18 +149,6 @@ TEST_F(ObsoleteFilesTest, RaceForObsoleteFileDeletion) {
TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) { TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) {
ReopenDB(); ReopenDB();
SyncPoint::GetInstance()->DisableProcessing();
std::vector<uint64_t> optsfiles_nums;
std::vector<bool> optsfiles_keep;
SyncPoint::GetInstance()->SetCallBack(
"DBImpl::PurgeObsoleteFiles:CheckOptionsFiles:1", [&](void* arg) {
optsfiles_nums.push_back(*reinterpret_cast<uint64_t*>(arg));
});
SyncPoint::GetInstance()->SetCallBack(
"DBImpl::PurgeObsoleteFiles:CheckOptionsFiles:2", [&](void* arg) {
optsfiles_keep.push_back(*reinterpret_cast<bool*>(arg));
});
SyncPoint::GetInstance()->EnableProcessing();
createLevel0Files(2, 50000); createLevel0Files(2, 50000);
CheckFileTypeCounts(wal_dir_, 1, 0, 0); CheckFileTypeCounts(wal_dir_, 1, 0, 0);
@ -176,7 +164,6 @@ TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) {
} }
} }
ASSERT_OK(dbfull()->EnableFileDeletions(true /* force */)); ASSERT_OK(dbfull()->EnableFileDeletions(true /* force */));
ASSERT_EQ(optsfiles_nums.size(), optsfiles_keep.size());
Close(); Close();

Loading…
Cancel
Save