Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
baixin01 committed Jun 28, 2024
1 parent 39ab078 commit ccf6b41
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conf/pika.conf
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ level0-slowdown-writes-trigger : 20
level0-file-num-compaction-trigger : 4

#rocksdb statistics tickers
open_rocksdb_statistics_tickers : no
open-rocksdb-statistics-tickers : no

# The maximum size of the response package to client to prevent memory
# exhaustion caused by commands like 'keys *' and 'Scan' which can generate huge response.
Expand Down
6 changes: 6 additions & 0 deletions src/pika_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2152,6 +2152,12 @@ void ConfigCmd::ConfigGet(std::string& ret) {
: EncodeString(&config_body, "resetchannels");
}

if (pstd::stringmatch(pattern.data(), "open-rocksdb-statistics-tickers", 1)) {
elements += 2;
EncodeString(&config_body, "open-rocksdb-statistics-tickers");
EncodeNumber(&config_body, g_pika_conf->open_rocksdb_statistics_tickers());
}

std::stringstream resp;
resp << "*" << std::to_string(elements) << "\r\n" << config_body;
ret = resp.str();
Expand Down
6 changes: 6 additions & 0 deletions src/pika_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,11 @@ int PikaConf::Load() {
max_rsync_parallel_num_ = kMaxRsyncParallelNum;
}

// rocksdb_statistics_tickers
std::string open_tickers;
GetConfStr("open-rocksdb-statistics-tickers", &open_tickers);
open_rocksdb_statistics_tickers_ = open_tickers == "yes";

int64_t tmp_rsync_timeout_ms = -1;
GetConfInt64("rsync-timeout-ms", &tmp_rsync_timeout_ms);
if(tmp_rsync_timeout_ms <= 0){
Expand Down Expand Up @@ -797,6 +802,7 @@ int PikaConf::ConfigRewrite() {
SetConfStr("slotmigrate", slotmigrate_.load() ? "yes" : "no");
SetConfInt64("slotmigrate-thread-num", slotmigrate_thread_num_);
SetConfInt64("thread-migrate-keys-num", thread_migrate_keys_num_);
SetConfStr("open-rocksdb-statistics-tickers", open_rocksdb_statistics_tickers_ ? "yes" : "no");
// slaveof config item is special
SetConfStr("slaveof", slaveof_);
// cache config
Expand Down

0 comments on commit ccf6b41

Please sign in to comment.