mirror of https://github.com/facebook/rocksdb.git
Fix flaky DBTestUniversalCompaction.UniversalCompactionTrivialMoveTest2
Summary: A previous fix to DBTestUniversalCompaction.UniversalCompactionTrivialMoveTest2 didn't address the right problem. The problem is L0->L0 compaction is not trivial move in the scenario, not parallel compactions. Fix this. Closes https://github.com/facebook/rocksdb/pull/1911 Differential Revision: D4608955 Pulled By: siying fbshipit-source-id: 7a712cb
This commit is contained in:
parent
96c7e1504a
commit
3b8ba703cb
|
@ -1028,13 +1028,15 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest1) {
|
||||||
// Test that checks trivial move in universal compaction
|
// Test that checks trivial move in universal compaction
|
||||||
TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) {
|
TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) {
|
||||||
int32_t trivial_move = 0;
|
int32_t trivial_move = 0;
|
||||||
int32_t non_trivial_move = 0;
|
|
||||||
rocksdb::SyncPoint::GetInstance()->SetCallBack(
|
rocksdb::SyncPoint::GetInstance()->SetCallBack(
|
||||||
"DBImpl::BackgroundCompaction:TrivialMove",
|
"DBImpl::BackgroundCompaction:TrivialMove",
|
||||||
[&](void* arg) { trivial_move++; });
|
[&](void* arg) { trivial_move++; });
|
||||||
rocksdb::SyncPoint::GetInstance()->SetCallBack(
|
rocksdb::SyncPoint::GetInstance()->SetCallBack(
|
||||||
"DBImpl::BackgroundCompaction:NonTrivial",
|
"DBImpl::BackgroundCompaction:NonTrivial", [&](void* arg) {
|
||||||
[&](void* arg) { non_trivial_move++; });
|
ASSERT_TRUE(arg != nullptr);
|
||||||
|
int output_level = *(static_cast<int*>(arg));
|
||||||
|
ASSERT_EQ(output_level, 0);
|
||||||
|
});
|
||||||
|
|
||||||
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
|
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
|
||||||
|
|
||||||
|
@ -1044,7 +1046,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) {
|
||||||
options.num_levels = 15;
|
options.num_levels = 15;
|
||||||
options.write_buffer_size = 100 << 10; // 100KB
|
options.write_buffer_size = 100 << 10; // 100KB
|
||||||
options.level0_file_num_compaction_trigger = 8;
|
options.level0_file_num_compaction_trigger = 8;
|
||||||
options.max_background_compactions = 1;
|
options.max_background_compactions = 2;
|
||||||
options.target_file_size_base = 64 * 1024;
|
options.target_file_size_base = 64 * 1024;
|
||||||
DestroyAndReopen(options);
|
DestroyAndReopen(options);
|
||||||
CreateAndReopenWithCF({"pikachu"}, options);
|
CreateAndReopenWithCF({"pikachu"}, options);
|
||||||
|
@ -1065,7 +1067,6 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) {
|
||||||
dbfull()->TEST_WaitForCompact();
|
dbfull()->TEST_WaitForCompact();
|
||||||
|
|
||||||
ASSERT_GT(trivial_move, 0);
|
ASSERT_GT(trivial_move, 0);
|
||||||
ASSERT_EQ(non_trivial_move, 0);
|
|
||||||
|
|
||||||
rocksdb::SyncPoint::GetInstance()->DisableProcessing();
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue