Skip to content

Clean log service log path after bootstrap#265

Merged
githubzilla merged 2 commits into
mainfrom
fix_cluster_fail_start
Dec 8, 2025
Merged

Clean log service log path after bootstrap#265
githubzilla merged 2 commits into
mainfrom
fix_cluster_fail_start

Conversation

@githubzilla

@githubzilla githubzilla commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator

Here are some reminders before you submit the pull request

  • Add tests for the change
  • Document changes
  • Reference the link of issue using fixes eloqdb/tx_service#issue_id
  • Reference the link of RFC if exists
  • Pass ./mtr --suite=mono_main,mono_multi,mono_basic

Summary by CodeRabbit

  • Bug Fixes

    • Improved shutdown cleanup in bootstrap mode to remove temporary log and optional local database storage, preventing residual data after shutdown.
  • Style

    • Added a repository-wide EditorConfig to standardize formatting, indentation and whitespace rules across file types.
  • Chores

    • Updated a logging submodule reference to a newer revision (no behavioral changes).

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

@coderabbitai

coderabbitai Bot commented Dec 4, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Adds filesystem cleanup during DataSubstrate shutdown when bootstrap mode is active, reorders includes in that source file, introduces a project-wide .editorconfig, and updates the log_service submodule pointer. No public API changes.

Changes

Cohort / File(s) Summary
Bootstrap Shutdown Cleanup
core/src/data_substrate.cpp
Adds <filesystem> and <iostream> includes and reorders headers. Extends DataSubstrate::Shutdown to detect bootstrap mode, strip a local:// prefix, and call std::filesystem::remove_all to delete the log storage path and—under #if defined(LOG_STATE_TYPE_RKDB_ALL)—the RocksDB storage path; logs operations and errors while preserving existing shutdown flow.
Repository config
/.editorconfig
Adds a new .editorconfig prescribing UTF-8, LF endings, final newline, trimming trailing whitespace, and file-type-specific indentation and formatting rules (C/C++, CMake, Python, shell, Markdown, JSON, YAML, etc.).
Submodule update
log_service (submodule)
Advances log_service submodule pointer from 9caaf7cd9e78ee4a6e4eb6e6b35bff16f852e249 to 93c641e0abf4a2c406b21187db90985f713fcf7a; no code changes in this diff.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Inspect bootstrap detection and conditional LOG_STATE_TYPE_RKDB_ALL handling in core/src/data_substrate.cpp.
  • Verify safe prefix stripping of local:// and path validation prior to std::filesystem::remove_all.
  • Review logging/error messages and cross-platform path considerations.
  • Quick scan of .editorconfig for intended team formatting.

Suggested reviewers

  • yi-xmu

Poem

🐰 I hopped through headers, tidy and lean,
Stripped the prefix, cleared the scene.
On shutdown I sweep logs away,
RocksDB dreams till break of day.
A tiny hop — the code feels clean!

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only a template checklist with unchecked boxes and no actual content describing the changes, objectives, or rationale for the pull request. Complete the description by filling in the checklist items and providing a detailed explanation of the changes, including which tests were added, documentation updates, issue references, and test results.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Clean log service log path after bootstrap' is concise and directly relates to the main change in the changeset—removing log storage paths during bootstrap shutdown.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aecb888 and c42694d.

📒 Files selected for processing (3)
  • .editorconfig (1 hunks)
  • core/src/data_substrate.cpp (2 hunks)
  • log_service (1 hunks)

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (2)
core/src/data_substrate.cpp (2)

252-279: Consider adding path validation for safety.

While bootstrap mode is a controlled scenario, adding validation to ensure paths are within the expected data directory would provide an extra safety layer against misconfiguration. For example, verify that paths start with core_config_.data_path.

However, if bootstrap cleanup is always expected to be safe and paths are strictly controlled, the current implementation may be acceptable.

Would you like me to generate a safer implementation with path validation?


26-27: Remove the unused <iostream> include.

The <filesystem> include is necessary for std::filesystem::remove_all, but <iostream> is not used anywhere in this file. Removing it reduces compilation overhead.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d380ba and 42d7f09.

📒 Files selected for processing (1)
  • core/src/data_substrate.cpp (2 hunks)
🔇 Additional comments (4)
core/src/data_substrate.cpp (4)

31-31: LGTM - Include reordering.

The include order change appears intentional and doesn't affect functionality.


247-251: LGTM - Safe path capture before resource destruction.

Capturing the storage paths before resetting log_server_ to nullptr ensures the paths remain accessible after the server is destroyed. This is the correct approach.


269-271: LGTM - Safe substring operation.

The substr(8) call is safe because line 269 verifies that storage_path starts with "local://" (which is exactly 8 characters), ensuring the string is long enough.


252-279: The inconsistency is intentional and correct—no fix needed.

The different prefix handling between RocksDB and log storage paths reflects their different initialization patterns:

  • RocksDB storage path is constructed in log_init.cpp line 279 by stripping the "local://" prefix: log_path.substr(8) + "/rocksdb". This path is stored without the prefix and returned as-is by GetRocksDBStoragePath().
  • Log storage path is passed to the log server with the "local://" prefix intact and returned by GetStoragePath() with that prefix still present, so it requires stripping at cleanup time.

The code correctly reflects that RocksDB paths never carry the "local://" prefix, while log paths do.

@githubzilla githubzilla force-pushed the fix_cluster_fail_start branch from aecb888 to c42694d Compare December 8, 2025 02:42
@githubzilla githubzilla merged commit 3e3d182 into main Dec 8, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants