Skip to content

Commit

Permalink
fix: fix variable init error (OpenAtomFoundation#2421)
Browse files Browse the repository at this point in the history
* fix variable init error

* fix by review comments

---------

Co-authored-by: wangshaoyi <[email protected]>
  • Loading branch information
wangshao1 and wangshaoyi authored Feb 27, 2024
1 parent 07e0aa2 commit 36d19d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/pika_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint64_t> rocksdb_ttl_second_ = 0;
Expand Down
12 changes: 5 additions & 7 deletions src/pika_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/storage/src/storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2269,7 +2269,7 @@ Status Storage::GetUsage(const std::string& property, uint64_t* const result) {
Status Storage::GetUsage(const std::string& property, std::map<int, uint64_t>* 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;
}
Expand Down

0 comments on commit 36d19d0

Please sign in to comment.