feat: 26786 Stop MerkleDb compaction during freeze - #26966
Draft
thenswan wants to merge 3 commits into
Draft
Conversation
Signed-off-by: Nikita Lebedev <nikita.lebedev@limechain.tech>
Signed-off-by: Nikita Lebedev <nikita.lebedev@limechain.tech>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #26966 +/- ##
============================================
+ Coverage 70.50% 70.53% +0.03%
Complexity 11692 11692
============================================
Files 2586 2586
Lines 108484 108493 +9
Branches 12146 12147 +1
============================================
+ Hits 76490 76530 +40
+ Misses 28014 27982 -32
- Partials 3980 3981 +1
... and 22 files with indirect coverage changes 🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 1eec3f5 Learn more about TestLens at testlens.app/docs. |
imalygin
requested changes
Aug 28, 2026
imalygin
left a comment
Contributor
There was a problem hiding this comment.
This approach is suboptimal, as it introduces dependency on Platform/Consensus modules. Keep in mind, that swirlds-state-api and swirlds-state-impl modules are used in Block Node which cannot depend on the platform
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.
Summary
Stop MerkleDb background compaction when the platform enters
FREEZING.VirtualMapStateLifecycleManagernow listens for platform status changes and, onFREEZING, disables new compaction work and interrupts running compactors without waiting for them to finish.Why this design
The platform status listener previously lived in
platform-core.state-implcould not use it directly becauseplatform-corealready depends onstate-impl, which would create a dependency cycle.The notification contracts were moved to
consensus-model, where the platform status already lives. This allowsVirtualMapStateLifecycleManagerto implement the listener directly.Compared with forwarding the status through platform wiring,
StateModule, or the Hedera application layer, this keeps the storage decision in the component that owns the active VirtualMap family and avoids introducing MerkleDb-specific behavior into unrelated layers.Why stop on
FREEZINGStopping compaction is a reaction to the node entering the freeze lifecycle, not to a snapshot being written. The freeze snapshot is only one consequence of that status change, so
SignedStateFileWriteris not the natural place to control background compaction.VirtualMapStateLifecycleManagerowns the active VirtualMap family and has direct access to its shared data source. HandlingFREEZINGthere keeps the lifecycle decision next to the resource it affects.It also happens earlier than the snapshot. The manager disables new submissions and interrupts running compactors without waiting, allowing hashing, signing, and snapshot creation to continue. Since all maps in the family share the same data source, freeze-snapshot flushes cannot start new compaction work.
The existing blocking operation remains available for data-source shutdown. Compaction does not need to be re-enabled because the node is restarted after the upgrade.
Commit structure
The PR is split into two commits to make review easier:
consensus-model.VirtualMapStateLifecycleManageras a listener, add the non-blocking compaction operation, and stop compaction onFREEZING.Related issue(s):
Fixes #26786