Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix configuration loading error #2218

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/pika_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ Status PikaConf::InternalGetTargetDB(const std::string& db_name, uint32_t* const
return Status::OK();
}

Status PikaConf::DBSlotsSanityCheck(const std::string& db_name, const std::set<uint32_t>& slot_ids,
bool is_add) {
Status PikaConf::DBSlotsSanityCheck(const std::string& db_name, const std::set<uint32_t>& slot_ids, bool is_add) {
std::shared_lock l(rwlock_);
uint32_t db_index = 0;
Status s = InternalGetTargetDB(db_name, &db_index);
Expand Down Expand Up @@ -181,7 +180,7 @@ int PikaConf::Load() {
GetConfStr("slotmigrate", &smgrt);
slotmigrate_ = (smgrt == "yes") ? true : false;

int binlog_writer_num = 1 ;
int binlog_writer_num = 1;
GetConfInt("binlog-writer-num", &binlog_writer_num);
if (binlog_writer_num <= 0 || binlog_writer_num > 24) {
binlog_writer_num_ = 1;
Expand Down Expand Up @@ -364,7 +363,7 @@ int PikaConf::Load() {

GetConfInt64("manually-resume-interval", &resume_check_interval_);
if (resume_check_interval_ <= 0) {
resume_check_interval_ = 60; // seconds
resume_check_interval_ = 60; // seconds
}

GetConfDouble("min-check-resume-ratio", &min_check_resume_ratio_);
Expand Down Expand Up @@ -577,7 +576,7 @@ int PikaConf::Load() {
master_run_id_ = master_run_id;
}
}
int cache_num = 16 ;
int cache_num = 16;
GetConfInt("cache-num", &cache_num);
cache_num_ = (0 >= cache_num || 48 < cache_num) ? 16 : cache_num;

Expand Down Expand Up @@ -611,7 +610,7 @@ int PikaConf::Load() {
GetConfInt("cache-maxmemory-policy", &cache_maxmemory_policy);
cache_maxmemory_policy_ = (0 > cache_maxmemory_policy || 7 < cache_maxmemory_policy) ? 1 : cache_maxmemory_policy;

int cache_maxmemory_samples = 5 ;
int cache_maxmemory_samples = 5;
GetConfInt("cache-maxmemory-samples", &cache_maxmemory_samples);
cache_maxmemory_samples_ = (1 > cache_maxmemory_samples) ? 5 : cache_maxmemory_samples;

Expand Down Expand Up @@ -661,8 +660,6 @@ int PikaConf::Load() {
GetConfInt64("blob-cache", &block_cache_);
GetConfInt64("blob-num-shard-bits", &blob_num_shard_bits_);

return ret;

// throttle-bytes-per-second
GetConfInt("throttle-bytes-per-second", &throttle_bytes_per_second_);
if (throttle_bytes_per_second_ <= 0) {
Expand All @@ -673,6 +670,8 @@ int PikaConf::Load() {
if (max_rsync_parallel_num_ <= 0) {
max_rsync_parallel_num_ = 4;
}

return ret;
}

void PikaConf::TryPushDiffCommands(const std::string& command, const std::string& value) {
Expand All @@ -681,7 +680,7 @@ void PikaConf::TryPushDiffCommands(const std::string& command, const std::string
}
}

void PikaConf::SetCacheType(const std::string &value) {
void PikaConf::SetCacheType(const std::string& value) {
cache_string_ = cache_set_ = cache_zset_ = cache_hash_ = cache_list_ = cache_bit_ = 0;
if (value == "") {
return;
Expand Down Expand Up @@ -791,7 +790,8 @@ int PikaConf::ConfigRewriteReplicationID() {
}
}
if (!filtered_items.empty()) {
pstd::BaseConf::Rep::ConfItem comment_item(pstd::BaseConf::Rep::kComment, "# Generated by ReplicationID CONFIG REWRITE\n");
pstd::BaseConf::Rep::ConfItem comment_item(pstd::BaseConf::Rep::kComment,
"# Generated by ReplicationID CONFIG REWRITE\n");
PushConfItem(comment_item);
for (const auto& item : filtered_items) {
PushConfItem(item);
Expand Down
Loading