diff --git a/db/version_set_test.cc b/db/version_set_test.cc index bb10017e9..410c2bc65 100644 --- a/db/version_set_test.cc +++ b/db/version_set_test.cc @@ -3526,9 +3526,15 @@ TEST_P(ChargeFileMetadataTestWithParam, Basic) { // file metadata above. This results in 1 * // CacheReservationManagerImpl::GetDummyEntrySize() // cache reservation for file metadata. + SyncPoint::GetInstance()->LoadDependency( + {{"DBImpl::BackgroundCallCompaction:PurgedObsoleteFiles", + "ChargeFileMetadataTestWithParam::" + "PreVerifyingCacheReservationRelease"}}); + SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr)); ASSERT_EQ("0,1", FilesPerLevel(0)); - + TEST_SYNC_POINT( + "ChargeFileMetadataTestWithParam::PreVerifyingCacheReservationRelease"); if (charge_file_metadata == CacheEntryRoleOptions::Decision::kEnabled) { EXPECT_EQ(file_metadata_charge_only_cache->GetCacheCharge(), 1 * CacheReservationManagerImpl< @@ -3536,6 +3542,7 @@ TEST_P(ChargeFileMetadataTestWithParam, Basic) { } else { EXPECT_EQ(file_metadata_charge_only_cache->GetCacheCharge(), 0); } + SyncPoint::GetInstance()->DisableProcessing(); // Destroying the db will delete the remaining 1 new file metadata // This results in no cache reservation for file metadata.