From 36d19d0b24572df184f91f1e72008cc86b753532 Mon Sep 17 00:00:00 2001 From: wangshao1 <30471730+wangshao1@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:18:59 +0800 Subject: [PATCH] fix: fix variable init error (#2421) * fix variable init error * fix by review comments --------- Co-authored-by: wangshaoyi --- include/pika_conf.h | 4 ++-- src/pika_conf.cc | 12 +++++------- src/storage/src/storage.cc | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/pika_conf.h b/include/pika_conf.h index f1b4dbe75b..6b0917ee76 100644 --- a/include/pika_conf.h +++ b/include/pika_conf.h @@ -735,8 +735,8 @@ class PikaConf : public pstd::BaseConf { int max_cache_statistic_keys_ = 0; int small_compaction_threshold_ = 0; int small_compaction_duration_threshold_ = 0; - int max_background_flushes_ = 0; - int max_background_compactions_ = 0; + int max_background_flushes_ = 1; + int max_background_compactions_ = 2; int max_background_jobs_ = 0; int max_cache_files_ = 0; std::atomic rocksdb_ttl_second_ = 0; diff --git a/src/pika_conf.cc b/src/pika_conf.cc index b00ce94c93..8086bb2285 100644 --- a/src/pika_conf.cc +++ b/src/pika_conf.cc @@ -361,16 +361,14 @@ int PikaConf::Load() { small_compaction_duration_threshold_ = 1000000; } - max_background_flushes_ = 1; GetConfInt("max-background-flushes", &max_background_flushes_); if (max_background_flushes_ <= 0) { max_background_flushes_ = 1; } - if (max_background_flushes_ >= 4) { - max_background_flushes_ = 4; + if (max_background_flushes_ >= 6) { + max_background_flushes_ = 6; } - max_background_compactions_ = 2; GetConfInt("max-background-compactions", &max_background_compactions_); if (max_background_compactions_ <= 0) { max_background_compactions_ = 2; @@ -379,13 +377,13 @@ int PikaConf::Load() { max_background_compactions_ = 8; } - max_background_jobs_ = (1 + 2); + max_background_jobs_ = max_background_flushes_ + max_background_compactions_; GetConfInt("max-background-jobs", &max_background_jobs_); if (max_background_jobs_ <= 0) { max_background_jobs_ = (1 + 2); } - if (max_background_jobs_ >= (8 + 4)) { - max_background_jobs_ = (8 + 4); + if (max_background_jobs_ >= (8 + 6)) { + max_background_jobs_ = (8 + 6); } max_cache_files_ = 5000; diff --git a/src/storage/src/storage.cc b/src/storage/src/storage.cc index 94427afb42..9fb252a7d0 100644 --- a/src/storage/src/storage.cc +++ b/src/storage/src/storage.cc @@ -2269,7 +2269,7 @@ Status Storage::GetUsage(const std::string& property, uint64_t* const result) { Status Storage::GetUsage(const std::string& property, std::map* const inst_result) { inst_result->clear(); for (const auto& inst : insts_) { - uint64_t value; + uint64_t value = 0; inst->GetProperty(property, &value); (*inst_result)[inst->GetIndex()] = value; }