test: Do not create data directory for memory databases#7323
Open
bthomee wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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()whennode_db.typeismemory. - 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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
TimothyBanks
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
High Level Overview of Change
This change skips creating the directory when an in-memory database is used.
Context of Change
Each time the
SHAMapStoreunit tests run, they needlessly create a directory named "main". Namely, whenonline_deleteis enabled in the config,SHAMapStoreImp's constructor callsdbPaths()atSHAMapStoreImp.cpp:160, which in turn:nodeDatabasesection.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.