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 ccf6b41 commit 426cb0d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/pika_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,12 @@ class PikaConf : public pstd::BaseConf {
pstd::StringSplit2Set(lower_value, ',', admin_cmd_set_);
}

void SetOpenRocksdbStatisticsTickers(const std::string& value) {
std::lock_guard l(rwlock_);
TryPushDiffCommands("open-rocksdb-statistics-tickers", value);
open_rocksdb_statistics_tickers_ = value == "true";
}

void SetCacheType(const std::string &value);
void SetCacheDisableFlag() { tmp_cache_disable_flag_ = true; }
int zset_cache_start_direction() { return zset_cache_start_direction_; }
Expand Down
16 changes: 16 additions & 0 deletions src/pika_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,7 @@ void ConfigCmd::ConfigSet(std::shared_ptr<DB> db) {
"slave-priority",
"sync-window-size",
"slow-cmd-list",
"open-rocksdb-statistics-tickers",
// Options for storage engine
// MutableDBOptions
"max-cache-files",
Expand Down Expand Up @@ -2861,6 +2862,21 @@ void ConfigCmd::ConfigSet(std::shared_ptr<DB> db) {
}
g_pika_conf->SetMaxConnRbufSize(static_cast<int>(ival));
res_.AppendStringRaw("+OK\r\n");
} else if (set_item == "open-rocksdb-statistics-tickers") {
std::string v(value);
pstd::StringToLower(v);
if (v != "yes" && v != "no") {
res_.AppendStringRaw("-ERR Invalid argument \'" + value + "\' for CONFIG SET 'open-rocksdb-statistics-tickers'\r\n");
return;
}
g_pika_conf->SetOpenRocksdbStatisticsTickers(value);
res_.AppendStringRaw("+OK\r\n");
if (pstd::string2int(value.data(), value.size(), &ival) == 0 || ival < PIKA_MAX_CONN_RBUF_LB || ival > PIKA_MAX_CONN_RBUF_HB * 2) {
res_.AppendStringRaw( "-ERR Invalid argument \'" + value + "\' for CONFIG SET 'max-conn-rbuf-size'\r\n");
return;
}
g_pika_conf->SetMaxConnRbufSize(static_cast<int>(ival));
res_.AppendStringRaw("+OK\r\n");
} else {
res_.AppendStringRaw("-ERR Unsupported CONFIG parameter: " + set_item + "\r\n");
}
Expand Down

0 comments on commit 426cb0d

Please sign in to comment.