Fix LSM snapshot restoration by resolving double path nesting#2111
Merged
Fix LSM snapshot restoration by resolving double path nesting#2111
Conversation
The LSM session was being initialised with the full lsmPath as both the
HasBlockIO root and the session's FsPath inside it, producing a doubled
on-disk layout like:
<state-dir>/lsm/<state-dir>/lsm/{active,snapshots,...}
instead of:
<state-dir>/lsm/{active,snapshots,...}.
Effect on snapshots: scripts/postgresql-setup.sh --create-snapshot looks
for the LSM tree at <state-dir>/lsm/snapshots/<slot>, didn't find it
because of the doubled path, silently fell back to the InMemory branch,
and produced a tarball missing the LSM tree files. On --restore-snapshot
+ db-sync startup the snapshot couldn't be loaded (ErrSnapshotDoesNotExist)
and sync replayed from genesis.
Fix:
Pass mkFsPath [] as the session's FsPath so it's rooted at the
HasBlockIO root directly. Also harden the snapshot script to abort with
a clear error when an lsm/ subtree exists but no LSM snapshot is found
at the expected path, instead of producing an incomplete tarball.
Files staged for commit:
- cardano-db-sync/src/Cardano/DbSync/Ledger/State.hs
- scripts/postgresql-setup.sh
kderme
approved these changes
Apr 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.
The LSM session was being initialised with the full lsmPath as both the HasBlockIO root and the session's FsPath inside it, producing a doubled on-disk layout like:
/lsm//lsm/{active,snapshots,...} instead of:
/lsm/{active,snapshots,...}.
Effect on snapshots: scripts/postgresql-setup.sh --create-snapshot looks for the LSM tree at /lsm/snapshots/, didn't find it because of the doubled path, silently fell back to the InMemory branch, and produced a tarball missing the LSM tree files. On --restore-snapshot
Fix:
Pass mkFsPath [] as the session's FsPath so it's rooted at the HasBlockIO root directly. Also harden the snapshot script to abort with a clear error when an lsm/ subtree exists but no LSM snapshot is found at the expected path, instead of producing an incomplete tarball.
Files staged for commit:
Description
Add your description here, if it fixes a particular issue please provide a link to the issue.
Checklist
fourmoluon version 0.17.0.0 (which can be run withscripts/fourmolize.sh)Migrations
If there is a breaking change, especially a big one, please add a justification here. Please elaborate
more what the migration achieves, what it cannot achieve or why a migration is not possible.