From e5a93c7720f9bffa5f7ab4e926ded0186f3a3c01 Mon Sep 17 00:00:00 2001 From: dayuanx <602457300@qq.com> Date: Sun, 8 Sep 2024 15:23:00 +0800 Subject: [PATCH] use universal compactions for tests --- YCSB/rocksdb/rocksdb.properties | 7 ++++--- YCSB/rocksdb/rocksdb_db.cc | 6 ++++++ db/art/clf_model.h | 5 ++--- examples/simple_example.cc | 5 +++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/YCSB/rocksdb/rocksdb.properties b/YCSB/rocksdb/rocksdb.properties index 4fdbcf04f..b170f21ab 100644 --- a/YCSB/rocksdb/rocksdb.properties +++ b/YCSB/rocksdb/rocksdb.properties @@ -1,5 +1,5 @@ -rocksdb.dbname=/tmp/ycc -rocksdb.nvm_path=/pg_wal/ycc/memory_art +rocksdb.dbname=/mnt/walsm/tmp/tmp_data/db_test_art +rocksdb.nvm_path=/mnt/walsm/node_memory rocksdb.format=single rocksdb.destroy=false @@ -24,4 +24,5 @@ rocksdb.compressed_cache_size=0 rocksdb.bloom_bits=0 rocksdb.increase_parallelism=true -rocksdb.optimize_level_style_compaction=true +# rocksdb.optimize_level_style_compaction=true +rocksdb.optimize_universal_style_compaction=true diff --git a/YCSB/rocksdb/rocksdb_db.cc b/YCSB/rocksdb/rocksdb_db.cc index 6362ab8c4..cc8fb2336 100644 --- a/YCSB/rocksdb/rocksdb_db.cc +++ b/YCSB/rocksdb/rocksdb_db.cc @@ -99,6 +99,9 @@ namespace { const std::string PROP_OPTIMIZE_LEVELCOMP = "rocksdb.optimize_level_style_compaction"; const std::string PROP_OPTIMIZE_LEVELCOMP_DEFAULT = "false"; + const std::string PROP_OPTIMIZE_UNIVERSALCOMP = "rocksdb.optimize_universal_style_compaction"; + const std::string PROP_OPTIMIZE_UNIVERSALCOMP_DEFAULT = "false"; + const std::string PROP_OPTIONS_FILE = "rocksdb.optionsfile"; const std::string PROP_OPTIONS_FILE_DEFAULT = ""; @@ -357,6 +360,9 @@ void RocksdbDB::GetOptions(const utils::Properties &props, rocksdb::Options *opt if (props.GetProperty(PROP_OPTIMIZE_LEVELCOMP, PROP_OPTIMIZE_LEVELCOMP_DEFAULT) == "true") { opt->OptimizeLevelStyleCompaction(); } + if (props.GetProperty(PROP_OPTIMIZE_UNIVERSALCOMP, PROP_OPTIMIZE_UNIVERSALCOMP_DEFAULT) == "true") { + opt->OptimizeUniversalStyleCompaction(); + } } } diff --git a/db/art/clf_model.h b/db/art/clf_model.h index f3f531490..def2bf820 100644 --- a/db/art/clf_model.h +++ b/db/art/clf_model.h @@ -42,12 +42,11 @@ struct RangeRatePair { } }; -bool RangeRatePairLessorComparor(const RangeRatePair& pair_1, const RangeRatePair& pair_2) { +inline bool RangeRatePairLessorComparor(const RangeRatePair& pair_1, const RangeRatePair& pair_2) { return pair_1.rate_in_segment < pair_2.rate_in_segment; } - -bool RangeRatePairGreatorComparor(const RangeRatePair& pair_1, const RangeRatePair& pair_2) { +inline bool RangeRatePairGreatorComparor(const RangeRatePair& pair_1, const RangeRatePair& pair_2) { return pair_1.rate_in_segment > pair_2.rate_in_segment; } diff --git a/examples/simple_example.cc b/examples/simple_example.cc index efc126ee2..6bca594e5 100644 --- a/examples/simple_example.cc +++ b/examples/simple_example.cc @@ -388,7 +388,8 @@ void ParseOptions(Options& options) { options.use_direct_io_for_flush_and_compaction = true; options.use_direct_reads = true; options.enable_pipelined_write = true; - options.OptimizeLevelStyleCompaction(); + // options.OptimizeLevelStyleCompaction(); + options.OptimizeUniversalStyleCompaction(); std::ifstream option_file("options.txt", std::ios::in); std::string line; @@ -425,7 +426,7 @@ void DoTest(std::string test_name) { options.use_direct_reads = true; options.enable_pipelined_write = true; options.compression = rocksdb::kNoCompression; - options.nvm_path = "/pg_wal/ycc/memory_art"; + options.nvm_path = "/mnt/walsm/node_memory"; options.IncreaseParallelism(16); std::string db_path = "/tmp/tmp_data/db_test_" + test_name;