-
Notifications
You must be signed in to change notification settings - Fork 970
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
Switch read-only LedgerTxn to BucketList snapshots #4431
Conversation
ec3d1ce
to
8540866
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I'm still reviewing, but here are a couple comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall a very helpful change! A few comments about hardening some asserts around BucketList based load access. Other than that, I think moving the snapshot logic into more of the domain of the LedgerManager
will help us consolidate the snapshotting logic, as well as prevent potential footguns in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RO ltx had caused us a lot of pain, I'm really happy to see this change!
d1c7816
to
71b5f89
Compare
I believe all the comments are addressed now, and parallel catchup on both testnet and pubnet passed. PTAL. I haven't squashed newer commits so it's easier to review, but I can do so once the PR is approved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question about the snapshotting in assumeState, but otherwise LGTM
Thanks for the change, LGTM! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks. Just a few minor cleanups (mostly const-related).
4315f1c
to
f4f04b0
Compare
b5f0423
to
cbb7de3
Compare
…ingle snapshot interface
cbb7de3
to
2f6c917
Compare
Resolves #4315 and #3800 This PR automatically switches overlay/herder to using BucketListDB snapshots instead of LedgerTxn.
This change introduces a single "read-only ledger state snapshot" interface, which supports both SQL (via LedgerTxn) and BucketListDB snapshots. A unified interface avoids invasive changes to the rest of the codebase to support both snapshot types, and allows to have a centralized validation flow for both overlay and apply time.
A notable change is the removal of nested LegderTxn in validation paths, and using loadWithoutRecord instead in newer protocols. This creates a stronger invariant that validation flow is only meant to be accessing read-only version of the ledger, and prevents it from making modifications by accident. Note that nested LedgerTxn is preserved for older buggy versions of the protocol (making the code a bit uglier than I would have preferred, I'm open to ideas on simplifying/refactoring old protocol logic out of the critical path).