Set create_if_missing as true if store_handler is non-shared#264
Conversation
WalkthroughModified initialization and validation logic in redis_service.cpp for RocksDB and EloqDS data store services. RocksDB handler now always receives Changes
Sequence DiagramsequenceDiagram
participant Init as Initialization Flow
participant Val as Multi-Node Validator
participant RDB as RocksDB Handler
participant DSS as DataStoreService
Init->>Val: Check node group config
alt Multiple node groups (ng_configs > 1)
Val->>Val: Log error
Val-->>Init: Return false (abort)
else Single node or bootstrap
Val-->>Init: Proceed
Init->>RDB: Initialize with create_if_missing=true
RDB-->>Init: Handler ready
Init->>DSS: Configure cluster topology
Init->>DSS: Call StartService(true)
DSS-->>Init: Service started
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/redis_service.cpp (1)
1009-1015: OK to force create_if_missing for local RocksDB; please fix comment typos.Logic matches the PR intent. Nit: clean up the comment (spelling/grammar).
- true, // for non shared storage, always pass - // create_if_missing=true, since no confilcts will happen - // under + true, // non-shared storage: always pass create_if_missing=true + // No conflicts are expected in multi-node deployments.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/redis_service.cpp(3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: build_log_service.cmake:103-118
Timestamp: 2025-09-24T09:00:44.250Z
Learning: The build_log_service.cmake file is specifically for building the log_service submodule which only supports ROCKSDB log state, unlike build_eloq_log_service.cmake which handles multiple WITH_LOG_STATE options (MEMORY, ROCKSDB, ROCKSDB_CLOUD_S3, ROCKSDB_CLOUD_GCS). Therefore, requiring RocksDB unconditionally in build_log_service.cmake is the correct behavior.
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: concourse/scripts/build_tarball_open.bash:121-121
Timestamp: 2025-09-26T05:07:45.185Z
Learning: The open log service in build_tarball_open.bash only supports ROCKSDB as the single log state option, unlike the main eloq log service which supports multiple WITH_LOG_STATE options. Therefore, no WITH_LOG_STATE configuration flag is needed for the open log service build.
📚 Learning: 2025-09-24T09:00:44.250Z
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: build_log_service.cmake:103-118
Timestamp: 2025-09-24T09:00:44.250Z
Learning: The build_log_service.cmake file is specifically for building the log_service submodule which only supports ROCKSDB log state, unlike build_eloq_log_service.cmake which handles multiple WITH_LOG_STATE options (MEMORY, ROCKSDB, ROCKSDB_CLOUD_S3, ROCKSDB_CLOUD_GCS). Therefore, requiring RocksDB unconditionally in build_log_service.cmake is the correct behavior.
Applied to files:
src/redis_service.cpp
📚 Learning: 2025-09-26T05:07:45.185Z
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: concourse/scripts/build_tarball_open.bash:121-121
Timestamp: 2025-09-26T05:07:45.185Z
Learning: The open log service in build_tarball_open.bash only supports ROCKSDB as the single log state option, unlike the main eloq log service which supports multiple WITH_LOG_STATE options. Therefore, no WITH_LOG_STATE configuration flag is needed for the open log service build.
Applied to files:
src/redis_service.cpp
📚 Learning: 2025-09-24T08:53:57.928Z
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.
Applied to files:
src/redis_service.cpp
🔇 Additional comments (2)
src/redis_service.cpp (2)
1107-1119: Verify DSS snapshot/WAL behavior with unconditional create_if_missing=true in RocksDB path.The approach is sound for non-shared storage; confirm that unconditionally creating the database does not impede snapshot or WAL catch-up on rejoining nodes. The optional runtime gflag override remains a reasonable enhancement for edge deployments:
DEFINE_bool(eloq_dss_create_if_missing, true, "If true, DSS with non-shared RocksDB creates DB when missing");
1061-1066: Multi-node detection fix is logically sound but requires manual verification of intent.Based on code analysis:
- Confirmed:
ng_configsisunordered_map<uint32_t, vector<NodeConfig>>whereis_candidate_is a field on individual nodes- Concern is valid: A single node group with multiple candidate nodes bypasses the current
ng_configs.size() > 1check, which only counts node groups- Suggested fix syntax appears correct: The proposed iteration pattern
for (const auto &pair : ng_configs) { for (const auto &n : pair.second)matches existing code patterns at lines 869 and 2072However, I could not locate the complete NodeConfig struct definition in search results. Before applying the fix, please verify:
- That single-group multi-node clusters with multiple candidate nodes are an actual supported scenario requiring the
eloq_dss_peer_nodeparameter- That the fix correctly identifies all nodes that should be counted as part of the multi-node cluster detection
Summary by CodeRabbit