This is an automated email from the ASF dual-hosted git repository.

twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new a4ccc21f feat(config): make rocksdb.dump_malloc_stats configurable 
(#2658)
a4ccc21f is described below

commit a4ccc21f04e307ce899d2c49d5e589cc1de922b4
Author: Nathan <[email protected]>
AuthorDate: Wed Nov 13 01:11:37 2024 -0500

    feat(config): make rocksdb.dump_malloc_stats configurable (#2658)
    
    Co-authored-by: hulk <[email protected]>
    Co-authored-by: Twice <[email protected]>
---
 kvrocks.conf           | 6 ++++++
 src/config/config.cc   | 1 +
 src/config/config.h    | 1 +
 src/storage/storage.cc | 2 +-
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/kvrocks.conf b/kvrocks.conf
index e7de065c..0ff0ce50 100644
--- a/kvrocks.conf
+++ b/kvrocks.conf
@@ -749,6 +749,12 @@ rocksdb.wal_compression no
 # default is 512MB
 rocksdb.max_total_wal_size 512
 
+# Whether to print malloc stats together with rocksdb.stats when printing to 
LOG.
+#
+# Accepted values: "yes", "no"
+# Default: yes
+rocksdb.dump_malloc_stats yes
+
 # We implement the replication with rocksdb WAL, it would trigger full sync 
when the seq was out of range.
 # wal_ttl_seconds and wal_size_limit_mb would affect how archived logs will be 
deleted.
 # If WAL_ttl_seconds is not 0, then WAL files will be checked every 
WAL_ttl_seconds / 2 and those that
diff --git a/src/config/config.cc b/src/config/config.cc
index f14dc78c..165e352f 100644
--- a/src/config/config.cc
+++ b/src/config/config.cc
@@ -258,6 +258,7 @@ Config::Config() {
                                                
rocksdb::CompressionType::kNoCompression)},
       {"rocksdb.wal_ttl_seconds", true, new 
IntField(&rocks_db.wal_ttl_seconds, 3 * 3600, 0, INT_MAX)},
       {"rocksdb.wal_size_limit_mb", true, new 
IntField(&rocks_db.wal_size_limit_mb, 16384, 0, INT_MAX)},
+      {"rocksdb.dump_malloc_stats", true, new 
YesNoField(&rocks_db.dump_malloc_stats, true)},
       {"rocksdb.max_total_wal_size", false, new 
IntField(&rocks_db.max_total_wal_size, 64 * 4 * 2, 0, INT_MAX)},
       {"rocksdb.disable_auto_compactions", false, new 
YesNoField(&rocks_db.disable_auto_compactions, false)},
       {"rocksdb.enable_pipelined_write", true, new 
YesNoField(&rocks_db.enable_pipelined_write, false)},
diff --git a/src/config/config.h b/src/config/config.h
index bc33ac97..61ac0cf8 100644
--- a/src/config/config.h
+++ b/src/config/config.h
@@ -197,6 +197,7 @@ struct Config {
     int wal_ttl_seconds;
     int wal_size_limit_mb;
     int max_total_wal_size;
+    bool dump_malloc_stats;
     int level0_slowdown_writes_trigger;
     int level0_stop_writes_trigger;
     int level0_file_num_compaction_trigger;
diff --git a/src/storage/storage.cc b/src/storage/storage.cc
index 234309f5..a446e3f0 100644
--- a/src/storage/storage.cc
+++ b/src/storage/storage.cc
@@ -191,7 +191,7 @@ rocksdb::Options Storage::InitRocksDBOptions() {
   options.WAL_size_limit_MB = 
static_cast<uint64_t>(config_->rocks_db.wal_size_limit_mb);
   options.max_total_wal_size = 
static_cast<uint64_t>(config_->rocks_db.max_total_wal_size * MiB);
   options.listeners.emplace_back(new EventListener(this));
-  options.dump_malloc_stats = true;
+  options.dump_malloc_stats = config_->rocks_db.dump_malloc_stats;
   sst_file_manager_ = 
std::shared_ptr<rocksdb::SstFileManager>(rocksdb::NewSstFileManager(rocksdb::Env::Default()));
   options.sst_file_manager = sst_file_manager_;
   int64_t max_io_mb = kIORateLimitMaxMb;

Reply via email to