From 4c422012046fd9c134039fc981f17e7547e93748 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Wed, 26 Feb 2014 16:24:56 -0800 Subject: [PATCH] [CF] Test fixes and speedup --- db/column_family_test.cc | 9 ++++++--- db/db_impl.cc | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/db/column_family_test.cc b/db/column_family_test.cc index 2843d308c..3dc5c0838 100644 --- a/db/column_family_test.cc +++ b/db/column_family_test.cc @@ -566,7 +566,7 @@ TEST(ColumnFamilyTest, DifferentWriteBufferSizes) { Reopen({default_cf, one, two, three}); - int micros_wait_for_flush = 100000; + int micros_wait_for_flush = 300000; PutRandomData(0, 100, 1000); env_->SleepForMicroseconds(micros_wait_for_flush); AssertNumberOfImmutableMemtables({0, 0, 0, 0}); @@ -669,13 +669,15 @@ TEST(ColumnFamilyTest, DifferentCompactionStyles) { CreateColumnFamilies({"one", "two"}); ColumnFamilyOptions default_cf, one, two; db_options_.max_open_files = 20; // only 10 files in file cache + db_options_.disableDataSync = true; default_cf.compaction_style = kCompactionStyleLevel; default_cf.num_levels = 3; default_cf.write_buffer_size = 64 << 10; // 64KB - default_cf.target_file_size_base = 512; + default_cf.target_file_size_base = 30 << 10; default_cf.filter_policy = nullptr; default_cf.no_block_cache = true; + default_cf.source_compaction_factor = 100; one.compaction_style = kCompactionStyleUniversal; // trigger compaction if there are >= 4 files @@ -699,7 +701,8 @@ TEST(ColumnFamilyTest, DifferentCompactionStyles) { PutRandomData(0, 2000, 4096); ASSERT_OK(Flush(0)); // clear levels 0 and 1 - CompactAll(0); + dbfull()->TEST_CompactRange(0, nullptr, nullptr, handles_[0]); + dbfull()->TEST_CompactRange(1, nullptr, nullptr, handles_[0]); ASSERT_EQ(NumTableFilesAtLevel(0, 0), 0); ASSERT_EQ(NumTableFilesAtLevel(1, 0), 0); // write some new keys into level 0 diff --git a/db/db_impl.cc b/db/db_impl.cc index c69ab9da4..1500a0dc8 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -2235,7 +2235,7 @@ Status DBImpl::InstallCompactionResults(CompactionState* compact) { compact->compaction->num_input_files(0), compact->compaction->level(), compact->compaction->num_input_files(1), - compact->compaction->level() + 1); + compact->compaction->output_level()); return Status::Corruption("Compaction input files inconsistent"); } @@ -2243,7 +2243,7 @@ Status DBImpl::InstallCompactionResults(CompactionState* compact) { compact->compaction->num_input_files(0), compact->compaction->level(), compact->compaction->num_input_files(1), - compact->compaction->level() + 1, + compact->compaction->output_level(), static_cast(compact->total_bytes)); // Add compaction outputs