Created
August 21, 2020 19:54
-
-
Save ajkr/7681bf61b1cdcf76e5510dc9ead2d482 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc | |
index 48a080446..a4dcb538f 100644 | |
--- a/db/db_compaction_test.cc | |
+++ b/db/db_compaction_test.cc | |
@@ -3646,9 +3646,20 @@ TEST_F(DBCompactionTest, NoCompactBottomLevelFilesWithDeletions) { | |
// just need to bump seqnum so ReleaseSnapshot knows the newest key in the SST | |
// files does not need to be preserved in case of a future snapshot. | |
ASSERT_OK(Put(Key(0), "val")); | |
- // release snapshot and no compaction should be triggered. | |
- db_->ReleaseSnapshot(snapshot); | |
- dbfull()->TEST_WaitForCompact(); | |
+ | |
+ { | |
+ // release snapshot and no compaction should be triggered. | |
+ std::atomic<int> num_compactions{0}; | |
+ ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( | |
+ "DBImpl::BackgroundCompaction:Start", | |
+ [&](void* /*arg*/) { num_compactions.fetch_add(1); }); | |
+ ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); | |
+ db_->ReleaseSnapshot(snapshot); | |
+ dbfull()->TEST_WaitForCompact(); | |
+ ASSERT_EQ(0, num_compactions); | |
+ ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); | |
+ } | |
+ | |
db_->GetLiveFilesMetaData(&post_release_metadata); | |
ASSERT_EQ(pre_release_metadata.size(), post_release_metadata.size()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment