From f75ee7f92b5fecbceb1442c825129fce665e2dc6 Mon Sep 17 00:00:00 2001 From: Binbin Date: Mon, 14 Aug 2023 11:34:25 +0800 Subject: [PATCH] Rename cluster-enable in kvrocks2redis to cluster-enabled Rename cluster-enable to cluster-enabled for keeping consistent with Kvrocks, we keeping the old one for compatibility. --- utils/kvrocks2redis/config.cc | 5 ++++- utils/kvrocks2redis/config.h | 2 +- utils/kvrocks2redis/kvrocks2redis.conf | 2 +- utils/kvrocks2redis/main.cc | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/utils/kvrocks2redis/config.cc b/utils/kvrocks2redis/config.cc index 907c9495ee1..8e48f8fff70 100644 --- a/utils/kvrocks2redis/config.cc +++ b/utils/kvrocks2redis/config.cc @@ -96,7 +96,10 @@ Status Config::parseConfigFromString(const std::string &input) { kvrocks_auth = args[2]; } } else if (size == 1 && key == "cluster-enable") { - cluster_enable = GET_OR_RET(yesnotoi(args[0]).Prefixed("key 'cluster-enable'")); + // Renamed to cluster-enabled, keeping the old one for compatibility. + cluster_enabled = GET_OR_RET(yesnotoi(args[0]).Prefixed("key 'cluster-enable'")); + } else if (size == 1 && key == "cluster-enabled") { + cluster_enabled = GET_OR_RET(yesnotoi(args[0]).Prefixed("key 'cluster-enabled'")); } else if (size >= 2 && strncasecmp(key.data(), "namespace.", 10) == 0) { std::string ns = original_key.substr(10); if (ns.size() > INT8_MAX) { diff --git a/utils/kvrocks2redis/config.h b/utils/kvrocks2redis/config.h index 51aa5ab8132..e67cae194f4 100644 --- a/utils/kvrocks2redis/config.h +++ b/utils/kvrocks2redis/config.h @@ -52,7 +52,7 @@ struct Config { std::string kvrocks_host; int kvrocks_port = 0; std::map tokens; - bool cluster_enable = false; + bool cluster_enabled = false; Status Load(std::string path); Config() = default; diff --git a/utils/kvrocks2redis/kvrocks2redis.conf b/utils/kvrocks2redis/kvrocks2redis.conf index b1cbefed36c..33a19555584 100644 --- a/utils/kvrocks2redis/kvrocks2redis.conf +++ b/utils/kvrocks2redis/kvrocks2redis.conf @@ -30,7 +30,7 @@ kvrocks 127.0.0.1 6666 # Enable cluster mode. # # Default: no -cluster-enable no +cluster-enabled no ################################ NAMESPACE AND Sync Target Redis ##################################### # Synchronize the specified namespace data to the specified Redis DB. diff --git a/utils/kvrocks2redis/main.cc b/utils/kvrocks2redis/main.cc index 9e93df6f2c7..76b0d7bc050 100644 --- a/utils/kvrocks2redis/main.cc +++ b/utils/kvrocks2redis/main.cc @@ -169,8 +169,8 @@ int main(int argc, char *argv[]) { Config kvrocks_config; kvrocks_config.db_dir = config.db_dir; - kvrocks_config.cluster_enabled = config.cluster_enable; - kvrocks_config.slot_id_encoded = config.cluster_enable; + kvrocks_config.cluster_enabled = config.cluster_enabled; + kvrocks_config.slot_id_encoded = config.cluster_enabled; engine::Storage storage(&kvrocks_config); s = storage.Open(true);