Skip to content

test: Do not create data directory for memory databases#7323

Open
bthomee wants to merge 1 commit into
developfrom
bthomee/memory_dir
Open

test: Do not create data directory for memory databases#7323
bthomee wants to merge 1 commit into
developfrom
bthomee/memory_dir

Conversation

@bthomee
Copy link
Copy Markdown
Collaborator

@bthomee bthomee commented May 26, 2026

High Level Overview of Change

This change skips creating the directory when an in-memory database is used.

Context of Change

Each time the SHAMapStore unit tests run, they needlessly create a directory named "main". Namely, when online_delete is enabled in the config, SHAMapStoreImp's constructor calls dbPaths() at SHAMapStoreImp.cpp:160, which in turn:

  1. Reads the configured path ("main") from the nodeDatabase section.
  2. Calls boost::filesystem::create_directories(dbPath), which creates the "main" directory regardless of whether the backend type is "memory".

The path validation/creation in dbPaths() makes no distinction between memory and disk backends. It unconditionally creates the directory, because it's designed to manage rotating backends that need sub-directories. Even though the memory backend doesn't actually write files, the dbPaths() function still creates the parent directory.

Copilot AI review requested due to automatic review settings May 26, 2026 10:22
Copy link
Copy Markdown
Contributor

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Choose a reason for hiding this comment

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

No issues.

Review by Claude Opus 4.6 · Prompt: V15

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents SHAMapStoreImp::dbPaths() from creating the configured node_db directory when the NodeStore backend is configured as an in-memory database (type = memory). This primarily avoids unnecessary filesystem side effects during unit tests that enable online_delete while using the memory backend.

Changes:

  • Add an early return in SHAMapStoreImp::dbPaths() when node_db.type is memory.
  • Avoid calling create_directories() (and subsequent directory scanning) for the in-memory backend.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bthomee bthomee added the Trivial Simple change with minimal effect, or already tested. Only needs one approval. label May 26, 2026
@bthomee bthomee requested a review from mvadari May 26, 2026 10:39
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.3%. Comparing base (a911f90) to head (1fbc499).

Files with missing lines Patch % Lines
src/xrpld/app/misc/SHAMapStoreImp.cpp 66.7% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #7323     +/-   ##
=========================================
- Coverage     82.4%   82.3%   -0.0%     
=========================================
  Files         1011    1011             
  Lines        76330   76332      +2     
  Branches      7318    7320      +2     
=========================================
- Hits         62874   62849     -25     
- Misses       13456   13483     +27     
Files with missing lines Coverage Δ
src/xrpld/app/misc/SHAMapStoreImp.cpp 69.3% <66.7%> (-6.1%) ⬇️

... and 5 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bthomee bthomee requested review from TimothyBanks and removed request for mvadari May 27, 2026 00:04
@bthomee bthomee requested a review from vlntb May 29, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Trivial Simple change with minimal effect, or already tested. Only needs one approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants