caipengbo commented on code in PR #2020:
URL: https://github.com/apache/kvrocks/pull/2020#discussion_r1451853065
##########
src/server/server.cc:
##########
@@ -152,6 +152,19 @@ Status Server::Start() {
}
}
+ std::string value;
+ auto cf = storage->GetCFHandle(engine::kPropagateColumnFamilyName);
+ rocksdb::Status check_cluster_enabled = storage->Get(rocksdb::ReadOptions(),
cf, rocksdb::Slice(engine::kClusterEnabledKey), &value);
+ if(check_cluster_enabled.IsNotFound()) {
+ s = storage->WriteToPropagateCF(engine::kClusterEnabledKey,
std::to_string(config_->cluster_enabled));
+ if(!s.IsOK()) return s;
+ } else if(check_cluster_enabled.ok()) {
+ // use the one that's previously persisted.
+ config_->cluster_enabled = std::stoi(value);
Review Comment:
In this line, I suggest printing a log warning that the persistence is
inconsistent with the configuration file.
##########
src/server/server.cc:
##########
@@ -152,6 +152,19 @@ Status Server::Start() {
}
}
+ std::string value;
+ auto cf = storage->GetCFHandle(engine::kPropagateColumnFamilyName);
+ rocksdb::Status check_cluster_enabled = storage->Get(rocksdb::ReadOptions(),
cf, rocksdb::Slice(engine::kClusterEnabledKey), &value);
+ if(check_cluster_enabled.IsNotFound()) {
+ s = storage->WriteToPropagateCF(engine::kClusterEnabledKey,
std::to_string(config_->cluster_enabled));
+ if(!s.IsOK()) return s;
+ } else if(check_cluster_enabled.ok()) {
+ // use the one that's previously persisted.
+ config_->cluster_enabled = std::stoi(value);
+ } else {
+ return {Status::NotOK, "failed reading from storage"};
Review Comment:
"failed to load cluster_enable from storage: "+
check_cluster_enabled.ToString()
##########
src/server/server.cc:
##########
@@ -152,6 +152,19 @@ Status Server::Start() {
}
}
+ std::string value;
Review Comment:
We'd better clarify this behavior in the configuration file:
https://github.com/apache/kvrocks/blob/9d656f1476583651e2fae20ed1c37cf35d0679ca/kvrocks.conf#L46-L48
--
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]