|
|
@ -110,6 +110,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionSingleSortedRun) {
|
|
|
|
options.write_buffer_size = 105 << 10; // 105KB
|
|
|
|
options.write_buffer_size = 105 << 10; // 105KB
|
|
|
|
options.arena_block_size = 4 << 10;
|
|
|
|
options.arena_block_size = 4 << 10;
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
// trigger compaction if there are >= 4 files
|
|
|
|
// trigger compaction if there are >= 4 files
|
|
|
|
KeepFilterFactory* filter = new KeepFilterFactory(true);
|
|
|
|
KeepFilterFactory* filter = new KeepFilterFactory(true);
|
|
|
|
filter->expect_manual_compaction_.store(false);
|
|
|
|
filter->expect_manual_compaction_.store(false);
|
|
|
@ -144,6 +146,8 @@ TEST_P(DBTestUniversalCompaction, OptimizeFiltersForHits) {
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
// trigger compaction if there are >= 4 files
|
|
|
|
// trigger compaction if there are >= 4 files
|
|
|
|
options.level0_file_num_compaction_trigger = 4;
|
|
|
|
options.level0_file_num_compaction_trigger = 4;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
BlockBasedTableOptions bbto;
|
|
|
|
BlockBasedTableOptions bbto;
|
|
|
|
bbto.cache_index_and_filter_blocks = true;
|
|
|
|
bbto.cache_index_and_filter_blocks = true;
|
|
|
|
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
|
|
bbto.filter_policy.reset(NewBloomFilterPolicy(10, false));
|
|
|
@ -213,6 +217,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrigger) {
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
// trigger compaction if there are >= 4 files
|
|
|
|
// trigger compaction if there are >= 4 files
|
|
|
|
options.level0_file_num_compaction_trigger = 4;
|
|
|
|
options.level0_file_num_compaction_trigger = 4;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
KeepFilterFactory* filter = new KeepFilterFactory(true);
|
|
|
|
KeepFilterFactory* filter = new KeepFilterFactory(true);
|
|
|
|
filter->expect_manual_compaction_.store(false);
|
|
|
|
filter->expect_manual_compaction_.store(false);
|
|
|
|
options.compaction_filter_factory.reset(filter);
|
|
|
|
options.compaction_filter_factory.reset(filter);
|
|
|
@ -317,6 +323,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionSizeAmplification) {
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
|
|
|
|
|
|
|
|
@ -359,6 +367,8 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionSizeAmplification) {
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
// Initial setup of compaction_options_universal will prevent universal
|
|
|
|
// Initial setup of compaction_options_universal will prevent universal
|
|
|
|
// compaction from happening
|
|
|
|
// compaction from happening
|
|
|
|
options.compaction_options_universal.size_ratio = 100;
|
|
|
|
options.compaction_options_universal.size_ratio = 100;
|
|
|
@ -439,6 +449,8 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionReadAmplification) {
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
// Initial setup of compaction_options_universal will prevent universal
|
|
|
|
// Initial setup of compaction_options_universal will prevent universal
|
|
|
|
// compaction from happening
|
|
|
|
// compaction from happening
|
|
|
|
options.compaction_options_universal.max_size_amplification_percent = 2000;
|
|
|
|
options.compaction_options_universal.max_size_amplification_percent = 2000;
|
|
|
@ -540,6 +552,8 @@ TEST_P(DBTestUniversalCompaction, CompactFilesOnUniversalCompaction) {
|
|
|
|
options.create_if_missing = true;
|
|
|
|
options.create_if_missing = true;
|
|
|
|
options.compaction_style = kCompactionStyleLevel;
|
|
|
|
options.compaction_style = kCompactionStyleLevel;
|
|
|
|
options.num_levels = 1;
|
|
|
|
options.num_levels = 1;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.target_file_size_base = options.write_buffer_size;
|
|
|
|
options.target_file_size_base = options.write_buffer_size;
|
|
|
|
options.compression = kNoCompression;
|
|
|
|
options.compression = kNoCompression;
|
|
|
|
options = CurrentOptions(options);
|
|
|
|
options = CurrentOptions(options);
|
|
|
@ -605,6 +619,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTargetLevel) {
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.num_levels = 7;
|
|
|
|
options.num_levels = 7;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.disable_auto_compactions = true;
|
|
|
|
options.disable_auto_compactions = true;
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
|
|
|
|
|
|
|
@ -651,6 +667,8 @@ TEST_P(DBTestUniversalCompactionMultiLevels, UniversalCompactionMultiLevels) {
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.level0_file_num_compaction_trigger = 8;
|
|
|
|
options.level0_file_num_compaction_trigger = 8;
|
|
|
|
options.max_background_compactions = 3;
|
|
|
|
options.max_background_compactions = 3;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.target_file_size_base = 32 * 1024;
|
|
|
|
options.target_file_size_base = 32 * 1024;
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
|
|
|
|
|
|
|
|
@ -696,6 +714,8 @@ TEST_P(DBTestUniversalCompactionMultiLevels, UniversalCompactionTrivialMove) {
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.max_background_compactions = 2;
|
|
|
|
options.max_background_compactions = 2;
|
|
|
|
options.target_file_size_base = 32 * 1024;
|
|
|
|
options.target_file_size_base = 32 * 1024;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
|
|
|
|
|
|
|
|
@ -741,6 +761,8 @@ TEST_P(DBTestUniversalCompactionParallel, UniversalCompactionParallel) {
|
|
|
|
options.max_background_compactions = 3;
|
|
|
|
options.max_background_compactions = 3;
|
|
|
|
options.max_background_flushes = 3;
|
|
|
|
options.max_background_flushes = 3;
|
|
|
|
options.target_file_size_base = 1 * 1024;
|
|
|
|
options.target_file_size_base = 1 * 1024;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.compaction_options_universal.max_size_amplification_percent = 110;
|
|
|
|
options.compaction_options_universal.max_size_amplification_percent = 110;
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
@ -800,6 +822,8 @@ TEST_P(DBTestUniversalCompactionParallel, PickByFileNumberBug) {
|
|
|
|
options.level0_file_num_compaction_trigger = 7;
|
|
|
|
options.level0_file_num_compaction_trigger = 7;
|
|
|
|
options.max_background_compactions = 2;
|
|
|
|
options.max_background_compactions = 2;
|
|
|
|
options.target_file_size_base = 1024 * 1024; // 1MB
|
|
|
|
options.target_file_size_base = 1024 * 1024; // 1MB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// Disable size amplifiction compaction
|
|
|
|
// Disable size amplifiction compaction
|
|
|
|
options.compaction_options_universal.max_size_amplification_percent =
|
|
|
|
options.compaction_options_universal.max_size_amplification_percent =
|
|
|
@ -916,6 +940,8 @@ INSTANTIATE_TEST_CASE_P(Parallel, DBTestUniversalCompactionParallel,
|
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBTestUniversalCompaction, UniversalCompactionOptions) {
|
|
|
|
TEST_P(DBTestUniversalCompaction, UniversalCompactionOptions) {
|
|
|
|
Options options = CurrentOptions();
|
|
|
|
Options options = CurrentOptions();
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.write_buffer_size = 105 << 10; // 105KB
|
|
|
|
options.write_buffer_size = 105 << 10; // 105KB
|
|
|
|
options.arena_block_size = 4 << 10; // 4KB
|
|
|
|
options.arena_block_size = 4 << 10; // 4KB
|
|
|
@ -951,6 +977,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionStopStyleSimilarSize) {
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.write_buffer_size = 105 << 10; // 105KB
|
|
|
|
options.write_buffer_size = 105 << 10; // 105KB
|
|
|
|
options.arena_block_size = 4 << 10; // 4KB
|
|
|
|
options.arena_block_size = 4 << 10; // 4KB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
// trigger compaction if there are >= 4 files
|
|
|
|
// trigger compaction if there are >= 4 files
|
|
|
|
options.level0_file_num_compaction_trigger = 4;
|
|
|
|
options.level0_file_num_compaction_trigger = 4;
|
|
|
@ -1037,7 +1065,9 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionCompressRatio1) {
|
|
|
|
|
|
|
|
|
|
|
|
Options options = CurrentOptions();
|
|
|
|
Options options = CurrentOptions();
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
@ -1105,6 +1135,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionCompressRatio2) {
|
|
|
|
Options options = CurrentOptions();
|
|
|
|
Options options = CurrentOptions();
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
@ -1150,6 +1182,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest1) {
|
|
|
|
options.compaction_options_universal.allow_trivial_move = true;
|
|
|
|
options.compaction_options_universal.allow_trivial_move = true;
|
|
|
|
options.num_levels = 2;
|
|
|
|
options.num_levels = 2;
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.max_background_compactions = 1;
|
|
|
|
options.max_background_compactions = 1;
|
|
|
|
options.target_file_size_base = 32 * 1024;
|
|
|
|
options.target_file_size_base = 32 * 1024;
|
|
|
@ -1196,6 +1230,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) {
|
|
|
|
options.compaction_options_universal.allow_trivial_move = true;
|
|
|
|
options.compaction_options_universal.allow_trivial_move = true;
|
|
|
|
options.num_levels = 15;
|
|
|
|
options.num_levels = 15;
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.level0_file_num_compaction_trigger = 8;
|
|
|
|
options.level0_file_num_compaction_trigger = 8;
|
|
|
|
options.max_background_compactions = 2;
|
|
|
|
options.max_background_compactions = 2;
|
|
|
|
options.target_file_size_base = 64 * 1024;
|
|
|
|
options.target_file_size_base = 64 * 1024;
|
|
|
@ -1235,6 +1271,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionFourPaths) {
|
|
|
|
options.compaction_options_universal.size_ratio = 5;
|
|
|
|
options.compaction_options_universal.size_ratio = 5;
|
|
|
|
options.write_buffer_size = 111 << 10; // 114KB
|
|
|
|
options.write_buffer_size = 111 << 10; // 114KB
|
|
|
|
options.arena_block_size = 4 << 10;
|
|
|
|
options.arena_block_size = 4 << 10;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.num_levels = 1;
|
|
|
|
options.num_levels = 1;
|
|
|
|
|
|
|
|
|
|
|
@ -1339,6 +1377,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionCFPathUse) {
|
|
|
|
options.compaction_options_universal.size_ratio = 10;
|
|
|
|
options.compaction_options_universal.size_ratio = 10;
|
|
|
|
options.write_buffer_size = 111 << 10; // 114KB
|
|
|
|
options.write_buffer_size = 111 << 10; // 114KB
|
|
|
|
options.arena_block_size = 4 << 10;
|
|
|
|
options.arena_block_size = 4 << 10;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.num_levels = 1;
|
|
|
|
options.num_levels = 1;
|
|
|
|
|
|
|
|
|
|
|
@ -1497,6 +1537,8 @@ TEST_P(DBTestUniversalCompaction, IncreaseUniversalCompactionNumLevels) {
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.num_levels = 1;
|
|
|
|
options.num_levels = 1;
|
|
|
|
options.write_buffer_size = 200 << 10; // 200KB
|
|
|
|
options.write_buffer_size = 200 << 10; // 200KB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.level0_file_num_compaction_trigger = 3;
|
|
|
|
options.memtable_factory.reset(new SpecialSkipListFactory(KNumKeysPerFile));
|
|
|
|
options.memtable_factory.reset(new SpecialSkipListFactory(KNumKeysPerFile));
|
|
|
|
options = CurrentOptions(options);
|
|
|
|
options = CurrentOptions(options);
|
|
|
@ -1576,6 +1618,8 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionSecondPathRatio) {
|
|
|
|
options.compaction_options_universal.size_ratio = 5;
|
|
|
|
options.compaction_options_universal.size_ratio = 5;
|
|
|
|
options.write_buffer_size = 111 << 10; // 114KB
|
|
|
|
options.write_buffer_size = 111 << 10; // 114KB
|
|
|
|
options.arena_block_size = 4 << 10;
|
|
|
|
options.arena_block_size = 4 << 10;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.level0_file_num_compaction_trigger = 2;
|
|
|
|
options.num_levels = 1;
|
|
|
|
options.num_levels = 1;
|
|
|
|
options.memtable_factory.reset(
|
|
|
|
options.memtable_factory.reset(
|
|
|
@ -1679,6 +1723,8 @@ TEST_P(DBTestUniversalCompaction, ConcurrentBottomPriLowPriCompactions) {
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
options.write_buffer_size = 100 << 10; // 100KB
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.target_file_size_base = 32 << 10; // 32KB
|
|
|
|
options.level0_file_num_compaction_trigger = kNumFilesTrigger;
|
|
|
|
options.level0_file_num_compaction_trigger = kNumFilesTrigger;
|
|
|
|
// Trigger compaction if size amplification exceeds 110%
|
|
|
|
// Trigger compaction if size amplification exceeds 110%
|
|
|
@ -1736,6 +1782,8 @@ TEST_P(DBTestUniversalCompaction, RecalculateScoreAfterPicking) {
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.compaction_style = kCompactionStyleUniversal;
|
|
|
|
options.level0_file_num_compaction_trigger = kNumFilesTrigger;
|
|
|
|
options.level0_file_num_compaction_trigger = kNumFilesTrigger;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
Reopen(options);
|
|
|
|
Reopen(options);
|
|
|
|
|
|
|
|
|
|
|
|
std::atomic<int> num_compactions_attempted(0);
|
|
|
|
std::atomic<int> num_compactions_attempted(0);
|
|
|
@ -1836,6 +1884,8 @@ TEST_P(DBTestUniversalManualCompactionOutputPathId,
|
|
|
|
options.num_levels = num_levels_;
|
|
|
|
options.num_levels = num_levels_;
|
|
|
|
options.target_file_size_base = 1 << 30; // Big size
|
|
|
|
options.target_file_size_base = 1 << 30; // Big size
|
|
|
|
options.level0_file_num_compaction_trigger = 10;
|
|
|
|
options.level0_file_num_compaction_trigger = 10;
|
|
|
|
|
|
|
|
options.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
options.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
Destroy(options);
|
|
|
|
Destroy(options);
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
DestroyAndReopen(options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
|
CreateAndReopenWithCF({"pikachu"}, options);
|
|
|
@ -1903,6 +1953,8 @@ TEST_F(DBTestUniversalCompaction2, BasicL0toL1) {
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
|
|
|
|
opts.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
opts.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
Reopen(opts);
|
|
|
|
Reopen(opts);
|
|
|
|
|
|
|
|
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
@ -1946,6 +1998,8 @@ TEST_F(DBTestUniversalCompaction2, SingleLevel) {
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
|
|
|
|
opts.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
opts.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
Reopen(opts);
|
|
|
|
Reopen(opts);
|
|
|
|
|
|
|
|
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
@ -1984,6 +2038,8 @@ TEST_F(DBTestUniversalCompaction2, MultipleLevels) {
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
|
|
|
|
opts.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
opts.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
Reopen(opts);
|
|
|
|
Reopen(opts);
|
|
|
|
|
|
|
|
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
@ -2056,6 +2112,8 @@ TEST_F(DBTestUniversalCompaction2, OverlappingL0) {
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
|
|
|
|
opts.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
opts.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
Reopen(opts);
|
|
|
|
Reopen(opts);
|
|
|
|
|
|
|
|
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
@ -2098,6 +2156,8 @@ TEST_F(DBTestUniversalCompaction2, IngestBehind) {
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.size_ratio = 10;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
|
|
|
|
opts.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
opts.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
Reopen(opts);
|
|
|
|
Reopen(opts);
|
|
|
|
|
|
|
|
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
|
// add an L1 file to prevent tombstones from dropping due to obsolescence
|
|
|
@ -2160,6 +2220,8 @@ TEST_F(DBTestUniversalCompaction2, PeriodicCompaction) {
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.min_merge_width = 2;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
opts.compaction_options_universal.max_size_amplification_percent = 200;
|
|
|
|
opts.periodic_compaction_seconds = 48 * 60 * 60; // 2 days
|
|
|
|
opts.periodic_compaction_seconds = 48 * 60 * 60; // 2 days
|
|
|
|
|
|
|
|
opts.memtable_whole_key_filtering = false;
|
|
|
|
|
|
|
|
opts.memtable_prefix_bloom_size_ratio = 0;
|
|
|
|
opts.num_levels = 5;
|
|
|
|
opts.num_levels = 5;
|
|
|
|
env_->SetMockSleep();
|
|
|
|
env_->SetMockSleep();
|
|
|
|
Reopen(opts);
|
|
|
|
Reopen(opts);
|
|
|
|