Correctly test both compaction styles in CompactionDeletionTriggerReopen

Summary:
CompactionDeletionTriggerReopen wasn't actually testing universal
compaction.

Test Plan: db_test

Reviewers: sdong, igor

Reviewed By: igor

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D28443
This commit is contained in:
Jonah Cohen 2014-11-06 17:28:49 -08:00
parent 8d87467bb0
commit ec101cd49a

View file

@ -3157,10 +3157,15 @@ Options DeletionTriggerOptions() {
} // anonymous namespace
TEST(DBTest, CompactionDeletionTrigger) {
Options options = CurrentOptions(DeletionTriggerOptions());
for (int tid = 0; tid < 2; ++tid) {
uint64_t db_size[2];
Options options = CurrentOptions(DeletionTriggerOptions());
if (tid == 1) {
// second pass with universal compaction
options.compaction_style = kCompactionStyleUniversal;
options.num_levels = 1;
}
DestroyAndReopen(options);
Random rnd(301);
@ -3184,10 +3189,6 @@ TEST(DBTest, CompactionDeletionTrigger) {
// must have much smaller db size.
ASSERT_GT(db_size[0] / 3, db_size[1]);
// repeat the test with universal compaction
options.compaction_style = kCompactionStyleUniversal;
options.num_levels = 1;
}
}
@ -3196,6 +3197,12 @@ TEST(DBTest, CompactionDeletionTriggerReopen) {
uint64_t db_size[3];
Options options = CurrentOptions(DeletionTriggerOptions());
if (tid == 1) {
// second pass with universal compaction
options.compaction_style = kCompactionStyleUniversal;
options.num_levels = 1;
}
DestroyAndReopen(options);
Random rnd(301);
@ -3238,10 +3245,6 @@ TEST(DBTest, CompactionDeletionTriggerReopen) {
db_size[2] = Size(Key(0), Key(kTestSize - 1));
// this time we're expecting significant drop in size.
ASSERT_GT(db_size[0] / 3, db_size[2]);
// repeat the test with universal compaction
options.compaction_style = kCompactionStyleUniversal;
options.num_levels = 1;
}
}