From ca17610c7978ca7f7d0a5b4fb96e74fd84eb99a7 Mon Sep 17 00:00:00 2001 From: githubzilla Date: Fri, 28 Nov 2025 22:23:37 +0800 Subject: [PATCH 1/4] Start data substrate when store_handler is nullptr only if data store is enabled --- src/redis_service.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/redis_service.cpp b/src/redis_service.cpp index 099beff8..769daf3b 100644 --- a/src/redis_service.cpp +++ b/src/redis_service.cpp @@ -189,8 +189,10 @@ bool RedisServiceImpl::Init(brpc::Server &brpc_server) LOG(ERROR) << "Error: TxService is not initialized."; return false; } + bool enable_store = + DataSubstrate::GetGlobal()->GetCoreConfig().enable_data_store; store_hd_ = DataSubstrate::GetGlobal()->GetStoreHandler(); - if (store_hd_ == nullptr) + if (enable_store && store_hd_ == nullptr) { LOG(ERROR) << "Error: DataStoreHandler is not initialized."; return false; From 333290927501c97047fe3239335e5fdb57b943f8 Mon Sep 17 00:00:00 2001 From: githubzilla Date: Sat, 29 Nov 2025 09:17:21 +0800 Subject: [PATCH 2/4] Fix build fail caused by mismatch of log_state and store_type --- concourse/scripts/pr.ent.bash | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/concourse/scripts/pr.ent.bash b/concourse/scripts/pr.ent.bash index c0d401fd..7711f54a 100755 --- a/concourse/scripts/pr.ent.bash +++ b/concourse/scripts/pr.ent.bash @@ -116,6 +116,11 @@ kv_store_types=("ELOQDSS_ROCKSDB_CLOUD_S3" "ROCKSDB") for bt in "${build_types[@]}"; do for kst in "${kv_store_types[@]}"; do rm -rf /home/$current_user/workspace/eloqkv/eloq_data + if [ "$kst" == "ELOQDSS_ROCKSDB_CLOUD_S3" ]; then + txlog_log_state="ROCKSDB_CLOUD_S3" + elif [ "$kst" == "ROCKSDB" ]; then + txlog_log_state="ROCKSDB" + fi run_build_ent $bt $kst source my_env/bin/activate From 57bb5debc09737e193704c6dd9688cb3ab769d40 Mon Sep 17 00:00:00 2001 From: githubzilla Date: Sat, 29 Nov 2025 12:00:29 +0800 Subject: [PATCH 3/4] Add pre-commit --- .gitignore | 3 --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index 9774dba6..9e8887cf 100644 --- a/.gitignore +++ b/.gitignore @@ -45,9 +45,6 @@ aws abseil-cpp -# pre-commit -.pre-commit-config.yaml - # Swap files *.swp *.swo diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..aa3bc896 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# See https://pre-commit.com/hooks.html for more hooks + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: trailing-whitespace + files: \.(cpp|cxx|cc|c|h|hpp|hxx|hh)$ + exclude: (^include/redis|^src/redis|^include/vector|^src/vector|^data_substrate/|^tests/|^lua|^fpconv) + - id: end-of-file-fixer + files: \.(cpp|cxx|cc|c|h|hpp|hxx|hh)$ + exclude: (^include/redis|^src/redis|^include/vector|^src/vector|^data_substrate/|^tests/|^lua|^fpconv) + - id: check-added-large-files + +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: v18.1.8 + hooks: + - id: clang-format + files: \.(cpp|cxx|cc|c|h|hpp|hxx|hh)$ + exclude: (^include/redis/|^src/redis/|^include/vector/|^src/vector/|^data_substrate/|^tests/|^lua/|^fpconv/) + args: [--style=file, --fallback-style=none, --verbose] From ec42c04326a59ba61513f5f570bf31f1f8487d9d Mon Sep 17 00:00:00 2001 From: githubzilla Date: Sat, 29 Nov 2025 12:00:42 +0800 Subject: [PATCH 4/4] Fix clang-format --- include/redis_command.h | 6 +++--- src/redis_service.cpp | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/redis_command.h b/include/redis_command.h index 200d791b..33c5cf95 100644 --- a/include/redis_command.h +++ b/include/redis_command.h @@ -1231,7 +1231,7 @@ struct PublishCommand : public DirectCommand { PublishCommand() = default; PublishCommand(std::string_view chan, std::string_view msg) - : chan_(chan), message_(msg){}; + : chan_(chan), message_(msg) {}; void Execute(RedisServiceImpl *redis_impl, RedisConnectionContext *ctx) override; @@ -7647,12 +7647,12 @@ struct TTLCommand : public RedisCommand { public: TTLCommand() - : is_pttl_(false), is_expire_time_(false), is_pexpire_time_(false){}; + : is_pttl_(false), is_expire_time_(false), is_pexpire_time_(false) {}; explicit TTLCommand(bool is_pttl, bool is_expire_time, bool is_pexpire_time) : is_pttl_(is_pttl), is_expire_time_(is_expire_time), - is_pexpire_time_(is_pexpire_time){}; + is_pexpire_time_(is_pexpire_time) {}; std::unique_ptr Clone() override; diff --git a/src/redis_service.cpp b/src/redis_service.cpp index 769daf3b..f1a4fb8e 100644 --- a/src/redis_service.cpp +++ b/src/redis_service.cpp @@ -19,6 +19,8 @@ * . * */ +#include "redis_service.h" + #include #include #include @@ -60,7 +62,6 @@ #include "redis_connection_context.h" #include "redis_handler.h" #include "redis_metrics.h" -#include "redis_service.h" #include "redis_stats.h" #include "redis_string_match.h" #include "sharder.h" @@ -901,7 +902,7 @@ void RedisServiceImpl::RedisClusterSlots(std::vector &info) } } } // end-if - } // end-for + } // end-for if (info.size() > 1) {