diff --git a/db/db_test_util.cc b/db/db_test_util.cc index 0e29cb2e4..bfed4de40 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -833,7 +833,7 @@ int DBTestBase::GetSstFileCount(std::string path) { // this will generate non-overlapping files since it keeps increasing key_idx void DBTestBase::GenerateNewFile(int cf, Random* rnd, int* key_idx, bool nowait) { - for (int i = 0; i < 100; i++) { + for (int i = 0; i < KNumKeysByGenerateNewFile; i++) { ASSERT_OK(Put(cf, Key(*key_idx), RandomString(rnd, (i == 99) ? 1 : 990))); (*key_idx)++; } @@ -845,7 +845,7 @@ void DBTestBase::GenerateNewFile(int cf, Random* rnd, int* key_idx, // this will generate non-overlapping files since it keeps increasing key_idx void DBTestBase::GenerateNewFile(Random* rnd, int* key_idx, bool nowait) { - for (int i = 0; i < 100; i++) { + for (int i = 0; i < KNumKeysByGenerateNewFile; i++) { ASSERT_OK(Put(Key(*key_idx), RandomString(rnd, (i == 99) ? 1 : 990))); (*key_idx)++; } diff --git a/db/db_test_util.h b/db/db_test_util.h index 8b22eee5f..b52e43ce9 100644 --- a/db/db_test_util.h +++ b/db/db_test_util.h @@ -710,6 +710,7 @@ class DBTestBase : public testing::Test { void GenerateNewFile(int fd, Random* rnd, int* key_idx, bool nowait = false); static const int kNumKeysByGenerateNewRandomFile; + static const int KNumKeysByGenerateNewFile = 100; void GenerateNewRandomFile(Random* rnd, bool nowait = false); diff --git a/db/db_universal_compaction_test.cc b/db/db_universal_compaction_test.cc index bc18a49b9..1c2100428 100644 --- a/db/db_universal_compaction_test.cc +++ b/db/db_universal_compaction_test.cc @@ -890,6 +890,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionFourPaths) { options.db_paths.emplace_back(dbname_ + "_2", 300 * 1024); options.db_paths.emplace_back(dbname_ + "_3", 500 * 1024); options.db_paths.emplace_back(dbname_ + "_4", 1024 * 1024 * 1024); + options.memtable_factory.reset( + new SpecialSkipListFactory(KNumKeysByGenerateNewFile - 1)); options.compaction_style = kCompactionStyleUniversal; options.compaction_options_universal.size_ratio = 5; options.write_buffer_size = 110 << 10; // 105KB