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
main
Jonah Cohen 10 years ago
parent 8d87467bb0
commit ec101cd49a
  1. 23
      db/db_test.cc

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

Loading…
Cancel
Save