Add Subcompactions to Universal Compaction Unit Tests
Summary: Now that the approach to parallelizing L0-L1 level-based compactions by breaking the compaction job into subcompactions is being extended to apply to universal compactions as well, the unit tests need to account for this and run the universal compaction tests with subcompactions both enabled and disabled. Test Plan: make all && make check Reviewers: sdong, igor, noetzli, anthony, yhchiang Reviewed By: yhchiang Subscribers: dhruba Differential Revision: https://reviews.facebook.net/D45657
This commit is contained in:
parent
c6d870ffb0
commit
8b689546b6
@ -374,7 +374,8 @@ TEST_F(DBTestCompactionFilter, CompactionFilterWithValueChange) {
|
|||||||
|
|
||||||
// push all files to lower levels
|
// push all files to lower levels
|
||||||
ASSERT_OK(Flush(1));
|
ASSERT_OK(Flush(1));
|
||||||
if (option_config_ != kUniversalCompactionMultiLevel) {
|
if (option_config_ != kUniversalCompactionMultiLevel &&
|
||||||
|
option_config_ != kUniversalSubcompactions) {
|
||||||
dbfull()->TEST_CompactRange(0, nullptr, nullptr, handles_[1]);
|
dbfull()->TEST_CompactRange(0, nullptr, nullptr, handles_[1]);
|
||||||
dbfull()->TEST_CompactRange(1, nullptr, nullptr, handles_[1]);
|
dbfull()->TEST_CompactRange(1, nullptr, nullptr, handles_[1]);
|
||||||
} else {
|
} else {
|
||||||
@ -392,7 +393,8 @@ TEST_F(DBTestCompactionFilter, CompactionFilterWithValueChange) {
|
|||||||
// push all files to lower levels. This should
|
// push all files to lower levels. This should
|
||||||
// invoke the compaction filter for all 100000 keys.
|
// invoke the compaction filter for all 100000 keys.
|
||||||
ASSERT_OK(Flush(1));
|
ASSERT_OK(Flush(1));
|
||||||
if (option_config_ != kUniversalCompactionMultiLevel) {
|
if (option_config_ != kUniversalCompactionMultiLevel &&
|
||||||
|
option_config_ != kUniversalSubcompactions) {
|
||||||
dbfull()->TEST_CompactRange(0, nullptr, nullptr, handles_[1]);
|
dbfull()->TEST_CompactRange(0, nullptr, nullptr, handles_[1]);
|
||||||
dbfull()->TEST_CompactRange(1, nullptr, nullptr, handles_[1]);
|
dbfull()->TEST_CompactRange(1, nullptr, nullptr, handles_[1]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3832,7 +3832,8 @@ TEST_F(DBTest, DropWrites) {
|
|||||||
env_->sleep_counter_.Reset();
|
env_->sleep_counter_.Reset();
|
||||||
env_->no_sleep_ = true;
|
env_->no_sleep_ = true;
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
if (option_config_ != kUniversalCompactionMultiLevel) {
|
if (option_config_ != kUniversalCompactionMultiLevel &&
|
||||||
|
option_config_ != kUniversalSubcompactions) {
|
||||||
for (int level = 0; level < dbfull()->NumberLevels(); level++) {
|
for (int level = 0; level < dbfull()->NumberLevels(); level++) {
|
||||||
if (level > 0 && level == dbfull()->NumberLevels() - 1) {
|
if (level > 0 && level == dbfull()->NumberLevels() - 1) {
|
||||||
break;
|
break;
|
||||||
|
@ -132,7 +132,7 @@ bool DBTestBase::ChangeOptions(int skip_mask) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch between different compaction styles (we have only 2 now).
|
// Switch between different compaction styles.
|
||||||
bool DBTestBase::ChangeCompactOptions() {
|
bool DBTestBase::ChangeCompactOptions() {
|
||||||
if (option_config_ == kDefault) {
|
if (option_config_ == kDefault) {
|
||||||
option_config_ = kUniversalCompaction;
|
option_config_ = kUniversalCompaction;
|
||||||
@ -152,7 +152,14 @@ bool DBTestBase::ChangeCompactOptions() {
|
|||||||
option_config_ = kLevelSubcompactions;
|
option_config_ = kLevelSubcompactions;
|
||||||
Destroy(last_options_);
|
Destroy(last_options_);
|
||||||
auto options = CurrentOptions();
|
auto options = CurrentOptions();
|
||||||
options.max_subcompactions = 4;
|
assert(options.max_subcompactions > 1);
|
||||||
|
TryReopen(options);
|
||||||
|
return true;
|
||||||
|
} else if (option_config_ == kLevelSubcompactions) {
|
||||||
|
option_config_ = kUniversalSubcompactions;
|
||||||
|
Destroy(last_options_);
|
||||||
|
auto options = CurrentOptions();
|
||||||
|
assert(options.max_subcompactions > 1);
|
||||||
TryReopen(options);
|
TryReopen(options);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -314,7 +321,13 @@ Options DBTestBase::CurrentOptions(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kLevelSubcompactions: {
|
case kLevelSubcompactions: {
|
||||||
options.max_subcompactions = 2;
|
options.max_subcompactions = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUniversalSubcompactions: {
|
||||||
|
options.compaction_style = kCompactionStyleUniversal;
|
||||||
|
options.num_levels = 8;
|
||||||
|
options.max_subcompactions = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +437,7 @@ class DBTestBase : public testing::Test {
|
|||||||
kOptimizeFiltersForHits = 26,
|
kOptimizeFiltersForHits = 26,
|
||||||
kRowCache = 27,
|
kRowCache = 27,
|
||||||
kLevelSubcompactions = 28,
|
kLevelSubcompactions = 28,
|
||||||
|
kUniversalSubcompactions = 29,
|
||||||
kEnd = 28
|
kEnd = 28
|
||||||
};
|
};
|
||||||
int option_config_;
|
int option_config_;
|
||||||
|
Loading…
Reference in New Issue
Block a user