From 9b25d26dc888ec5a1adef0bcb9032375e048e779 Mon Sep 17 00:00:00 2001 From: Levi Tamasi Date: Thu, 5 Aug 2021 18:35:02 -0700 Subject: [PATCH] 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 --- db/db_impl/db_impl_files.cc | 6 ------ db/obsolete_files_test.cc | 13 ------------- 2 files changed, 19 deletions(-) diff --git a/db/db_impl/db_impl_files.cc b/db/db_impl/db_impl_files.cc index 1792cefd5..5b2c429cd 100644 --- a/db/db_impl/db_impl_files.cc +++ b/db/db_impl/db_impl_files.cc @@ -524,12 +524,6 @@ void DBImpl::PurgeObsoleteFiles(JobContext& state, bool schedule_only) { break; case kOptionsFile: keep = (number >= optsfile_num2); - TEST_SYNC_POINT_CALLBACK( - "DBImpl::PurgeObsoleteFiles:CheckOptionsFiles:1", - reinterpret_cast(&number)); - TEST_SYNC_POINT_CALLBACK( - "DBImpl::PurgeObsoleteFiles:CheckOptionsFiles:2", - reinterpret_cast(&keep)); break; case kCurrentFile: case kDBLockFile: diff --git a/db/obsolete_files_test.cc b/db/obsolete_files_test.cc index 3d18196e6..d4348283c 100644 --- a/db/obsolete_files_test.cc +++ b/db/obsolete_files_test.cc @@ -149,18 +149,6 @@ TEST_F(ObsoleteFilesTest, RaceForObsoleteFileDeletion) { TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) { ReopenDB(); - SyncPoint::GetInstance()->DisableProcessing(); - std::vector optsfiles_nums; - std::vector optsfiles_keep; - SyncPoint::GetInstance()->SetCallBack( - "DBImpl::PurgeObsoleteFiles:CheckOptionsFiles:1", [&](void* arg) { - optsfiles_nums.push_back(*reinterpret_cast(arg)); - }); - SyncPoint::GetInstance()->SetCallBack( - "DBImpl::PurgeObsoleteFiles:CheckOptionsFiles:2", [&](void* arg) { - optsfiles_keep.push_back(*reinterpret_cast(arg)); - }); - SyncPoint::GetInstance()->EnableProcessing(); createLevel0Files(2, 50000); CheckFileTypeCounts(wal_dir_, 1, 0, 0); @@ -176,7 +164,6 @@ TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) { } } ASSERT_OK(dbfull()->EnableFileDeletions(true /* force */)); - ASSERT_EQ(optsfiles_nums.size(), optsfiles_keep.size()); Close();