cmd/utils: grant snapshot cache to trie if disabled #21416
Merged
+3
−2
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.
When we implemented the snapshotter, we distributed the
--cache
memory allowance as:Before merging the snapshotter however, we hid it behind an opt-in flag
--snapshot
. We did not however implement this opt-in mechanism in the cache distribution code, so if snapshots are not enabled, we ran with 90% allowance only. This PR fixes it by granting the snapshot cache back to the trie clean cache if snapshots are disabled.Fun fact, this fault only happens on mainnet or with custom
--cache
settings, because the defaults are calculated differently. Which were also "borked" as they followed an older hack where the snapshot cache was piled on top as 25% extra. This PR also fixes that for testnets by using 15+10 split instead of 25+25 (out of 25).