git-hulk commented on code in PR #2020:
URL: https://github.com/apache/kvrocks/pull/2020#discussion_r1451963120
##########
src/server/server.cc:
##########
@@ -1839,6 +1844,26 @@ void Server::cleanupExitedWorkerThreads(bool force) {
}
}
+Status Server::forceClusterMode() {
Review Comment:
Is overrideClusterMode better than forceClusterMode?
##########
src/server/server.cc:
##########
@@ -1839,6 +1844,26 @@ void Server::cleanupExitedWorkerThreads(bool force) {
}
}
+Status Server::forceClusterMode() {
+ 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()) {
+ Status s = storage->WriteToPropagateCF(engine::kClusterEnabledKey,
std::to_string(config_->cluster_enabled));
+ if (!s.IsOK()) return s;
+ } else {
+ if (check_cluster_enabled.ok()) {
+ LOG(WARNING) << "cluster_enable status is inconsistent. Using the
previously persisted one.";
Review Comment:
Need to compare the configuration between the config file and rocksdb? or it
might confuse users.
##########
src/server/server.cc:
##########
@@ -1839,6 +1844,26 @@ void Server::cleanupExitedWorkerThreads(bool force) {
}
}
+Status Server::forceClusterMode() {
+ 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()) {
+ Status s = storage->WriteToPropagateCF(engine::kClusterEnabledKey,
std::to_string(config_->cluster_enabled));
+ if (!s.IsOK()) return s;
Review Comment:
Can return the status directly if the key is not found
```suggestion
return storage->WriteToPropagateCF(engine::kClusterEnabledKey,
std::to_string(config_->cluster_enabled));
```
##########
src/server/server.cc:
##########
@@ -1839,6 +1844,26 @@ void Server::cleanupExitedWorkerThreads(bool force) {
}
}
+Status Server::forceClusterMode() {
+ 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()) {
+ Status s = storage->WriteToPropagateCF(engine::kClusterEnabledKey,
std::to_string(config_->cluster_enabled));
Review Comment:
I prefer using `yes` or `no` instead of the bool value.
--
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]