PragmaTwice commented on code in PR #2020:
URL: https://github.com/apache/kvrocks/pull/2020#discussion_r1451890263


##########
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:
   Could you move these lines to a separate function?



-- 
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]

Reply via email to