Skip to content

Commit

Permalink
feat(config): make rocksdb.dump_malloc_stats configurable (apache#2658)
Browse files Browse the repository at this point in the history
Co-authored-by: hulk <[email protected]>
Co-authored-by: Twice <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent 79f4d52 commit a4ccc21
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions kvrocks.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down
1 change: 1 addition & 0 deletions src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/storage/storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4ccc21

Please sign in to comment.