Skip to content

LedgerDB: prune on garbage collection instead of on every change #1513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: amesgen/v2-ledgerseq-close
Choose a base branch
from

Conversation

amesgen
Copy link
Member

@amesgen amesgen commented May 19, 2025

This is in preparation for #1424

Targets #1516 as the changes in this PR fix a bug revealed by the fix in #1516

TODO:

  • Changelogs
  • More comments
  • Tweak snapshotting to use the immutable state (which no longer is the anchor of the DbChangelog/LedgerSeq.

@amesgen amesgen changed the base branch from cardano-node-10.4-backports to main May 20, 2025 15:03
@amesgen amesgen force-pushed the amesgen/ledgerdb-garbage-collect-states branch 2 times, most recently from 8b48bb3 to 045f1cc Compare May 20, 2025 15:15
@amesgen amesgen changed the base branch from main to amesgen/v2-ledgerseq-close May 20, 2025 15:15
amesgen added 8 commits May 20, 2025 18:47
It is not necessary to perform the garbage collection of the LedgerDB and the
map of invalid blocks in the same STM transaction. In the past, this was
important, but it is not anymore, see
#1507.
No behavioral change, just a refactoring by extracting common parts; convenient
for follow-up changes
regarding the previous few commits
@amesgen amesgen force-pushed the amesgen/ledgerdb-garbage-collect-states branch from 2037a0f to 2fc8d06 Compare May 20, 2025 17:00
This ensures that the underlying handle isn't garbage-collected, as we only
schedule a garbage collection for all states with a slot number strictly smaller
than the immutable tip.

Also, a very small benefit is that we get (slightly) faster replay on node
startup.
@amesgen amesgen force-pushed the amesgen/ledgerdb-garbage-collect-states branch 2 times, most recently from c3a08d1 to 13e5533 Compare May 20, 2025 17:24
This is used in db-analyser only, where everything happens synchronously in a
single thread, so it is fine to immediately prune.

V1 already does this.
@amesgen amesgen force-pushed the amesgen/ledgerdb-garbage-collect-states branch from 13e5533 to 68402ed Compare May 20, 2025 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant