Skip to content

Start data substrate when store_handler is nullptr only if data store is enabled#309

Merged
githubzilla merged 4 commits intomainfrom
test_fail_store_disabled
Nov 29, 2025
Merged

Start data substrate when store_handler is nullptr only if data store is enabled#309
githubzilla merged 4 commits intomainfrom
test_fail_store_disabled

Conversation

@githubzilla
Copy link
Collaborator

@githubzilla githubzilla commented Nov 28, 2025

… is enabled

Summary by CodeRabbit

  • Bug Fixes

    • Initialization now skips optional data-store validation when storage is disabled in config, reducing startup failures when optional storage components are unavailable.
    • Transaction logging state is set according to the configured key-value store type, improving correctness of logging and diagnostics.
  • Chores

    • Added a pre-commit configuration to enforce formatting and whitespace rules.
  • Style

    • Minor constructor formatting adjustments.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Walkthrough

Adds a config-driven guard to DataStoreHandler validation in src/redis_service.cpp; sets txlog_log_state in concourse/scripts/pr.ent.bash based on kv_store_type; adds a pre-commit configuration and removes its ignore entry from .gitignore; minor formatting in include/redis_command.h.

Changes

Cohort / File(s) Summary
DataStoreHandler initialization guard
src/redis_service.cpp
Read local enable_store from DataSubstrate::GetGlobal()->GetCoreConfig().enable_data_store and only treat store_hd_ == nullptr as an error when enable_store is true; allows Init to proceed when data store is disabled.
txlog_log_state assignment in PR script
concourse/scripts/pr.ent.bash
Inside the loop, set txlog_log_state to ROCKSDB_CLOUD_S3 when kv_store_type is ELOQDSS_ROCKSDB_CLOUD_S3, and to ROCKSDB when kv_store_type is ROCKSDB.
Pre-commit config added & gitignore updated
.pre-commit-config.yaml, .gitignore
Add .pre-commit-config.yaml with hooks (trailing-whitespace, end-of-file-fixer, check-added-large-files, clang-format) and remove .pre-commit-config.yaml from .gitignore so it can be tracked.
Formatting tweak
include/redis_command.h
Minor initializer-list spacing/formatting changes in two constructors; no signature or behavior changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify GetCoreConfig().enable_data_store is initialized at this callsite.
  • Confirm code paths do not later dereference store_hd_ when enable_store is false.
  • Check the new pre-commit exclusions and clang-format args for intended scope.

Possibly related PRs

  • Update cluster config #256 — Modifies DSS config and conditional store connection/startup; closely related to data-store startup logic changed here.

Suggested reviewers

  • liunyl
  • zhangh43

Poem

🐰 I nudged a tiny guard where configs grow,
If stores sleep, Init skips the show.
If enabled, I double-check the gate—
A hop, a sniff, the service wakes up straight. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly aligns with the main change in src/redis_service.cpp: modifying DataStoreHandler initialization to only error when data store is enabled and handler is null.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test_fail_store_disabled

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/redis_service.cpp (1)

192-196: Init now correctly skips DataStoreHandler null-check when store is disabled

The new enable_store guard makes Init succeed when enable_data_store is false even if store_hd_ is null, which matches the later skip_kv_ = !enable_data_store behavior. This looks correct and should fix the previous failure mode when running with store disabled.

If you want to reduce duplication, you could cache GetCoreConfig() once and reuse enable_store again at line 230 when initializing skip_kv_, but that's purely optional.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfb6d9d and ca17610.

📒 Files selected for processing (1)
  • src/redis_service.cpp (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: src/redis_service.cpp:94-118
Timestamp: 2025-09-24T08:53:57.928Z
Learning: The LOG_STATE_TYPE_RKDB_CLOUD macro gating in src/redis_service.cpp includes `&& !defined(LOG_STATE_TYPE_RKDB)` condition intentionally to prevent conflicts when LOG_STATE_TYPE_RKDB is defined unconditionally in some builds (build_log_service.cmake) alongside cloud variants. The CMake configuration in build_eloq_log_service.cmake ensures mutual exclusivity of log state types.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3332909 and ec42c04.

📒 Files selected for processing (4)
  • .gitignore (0 hunks)
  • .pre-commit-config.yaml (1 hunks)
  • include/redis_command.h (2 hunks)
  • src/redis_service.cpp (3 hunks)
💤 Files with no reviewable changes (1)
  • .gitignore
✅ Files skipped from review due to trivial changes (1)
  • include/redis_command.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/redis_service.cpp
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: src/redis_service.cpp:94-118
Timestamp: 2025-09-24T08:53:57.928Z
Learning: The LOG_STATE_TYPE_RKDB_CLOUD macro gating in src/redis_service.cpp includes `&& !defined(LOG_STATE_TYPE_RKDB)` condition intentionally to prevent conflicts when LOG_STATE_TYPE_RKDB is defined unconditionally in some builds (build_log_service.cmake) alongside cloud variants. The CMake configuration in build_eloq_log_service.cmake ensures mutual exclusivity of log state types.
🔇 Additional comments (1)
.pre-commit-config.yaml (1)

15-21: Well-structured clang-format integration.

The clang-format hook is properly configured with sensible defaults:

  • Targets the same C/C++ file extensions as the other hooks.
  • Excludes third-party and generated code appropriately.
  • The --style=file --fallback-style=none arguments ensure the hook respects a .clang-format configuration file if present, otherwise disables fallback styling (enforcing explicit project configuration).
  • Verbose output aids in debugging formatting issues in CI/pre-commit runs.

Comment on lines +7 to +21
- 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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent path patterns across hooks may cause mismatches.

The exclusion patterns are inconsistent between the first two hooks and the clang-format hook:

  • Lines 9, 12: Use ^lua|^fpconv (no trailing slashes)
  • Line 20: Use ^lua/|^fpconv/ (with trailing slashes)

This inconsistency could cause the trailing-whitespace and end-of-file-fixer hooks to behave differently from clang-format when matching excluded directories. Regex patterns without trailing slashes may match files or directories with those names anywhere in the path, whereas patterns with slashes explicitly target directory boundaries.

Standardize the exclusion patterns for consistency:

- - 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: 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/)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- 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]
- 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]
🤖 Prompt for AI Agents
In .pre-commit-config.yaml around lines 7 to 21, the exclude regexes are
inconsistent (some entries use ^lua|^fpconv without trailing slashes while
clang-format uses ^lua/|^fpconv/), which can cause different matching behavior
across hooks; standardize the exclusion patterns across all hooks by making them
the same form (for example, append trailing slashes to the patterns on lines 9
and 12 to match the clang-format style: use ^lua/ and ^fpconv/), and ensure any
other hook exclude lines are updated to the same normalized regex so all hooks
behave consistently.

@githubzilla githubzilla merged commit da31b23 into main Nov 29, 2025
4 of 5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants