mapleFU commented on code in PR #3034:
URL: https://github.com/apache/kvrocks/pull/3034#discussion_r2177629773
##########
src/config/config.cc:
##########
@@ -728,6 +728,26 @@ void Config::initFieldCallback() {
srv->storage->SetSstFileDeleteRateBytesPerSecond(rocks_db.sst_file_delete_rate_bytes_per_sec);
return Status::OK();
}},
+ {"rocksdb.level0_slowdown_writes_trigger",
+ [this, &set_cf_option_cb](Server *srv, const std::string &k,
[[maybe_unused]] const std::string &v) -> Status {
+ if (rocks_db.level0_slowdown_writes_trigger == 0) {
+ return set_cf_option_cb(srv, k,
std::to_string(rocks_db.level0_stop_writes_trigger));
+ } else {
+ return set_cf_option_cb(srv, k,
std::to_string(rocks_db.level0_slowdown_writes_trigger));
+ }
+ }},
+ {"rocksdb.level0_stop_writes_trigger",
+ [this, &set_cf_option_cb](Server *srv, const std::string &k,
[[maybe_unused]] const std::string &v) -> Status {
+ if (rocks_db.level0_slowdown_writes_trigger == 0) {
+ Status s = set_cf_option_cb(srv,
"rocksdb.level0_slowdown_writes_trigger",
+
std::to_string(rocks_db.level0_stop_writes_trigger));
+ if (!s.IsOK()) {
+ return s;
+ }
+ }
+
+ return set_cf_option_cb(srv, k,
std::to_string(rocks_db.level0_stop_writes_trigger));
Review Comment:
```
Status Storage::SetOptionForAllColumnFamilies(const std::string &key, const
std::string &value) {
for (auto &cf_handle : cf_handles_) {
auto s = db_->SetOptions(cf_handle, {{key, value}});
if (!s.ok()) return {Status::NotOK, s.ToString()};
}
return Status::OK();
}
```
This method create a `std::map<std::string, std::string>`, and update the
`cf_handles_` configs. If `level0_slowdown_writes_trigger` is set firstly, I
wonder whether it would:
1. being duplicated called?
2. Failed set when `rocks_db.level0_stop_writes_trigger` is too large?
Should we reverse this order? Or set the two elements using std::map
together?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]