-
Notifications
You must be signed in to change notification settings - Fork 113
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
1. feat(db): Store transactions in a separate database index, to improve query speed #3934
Conversation
dff81df
to
72f0656
Compare
This comment was marked as resolved.
This comment was marked as resolved.
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, but I have a question about something that might need changing
72f0656
to
feaf30a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
04209f0
to
fce2ffe
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Turns out that splitting transactions out might actually be faster than writing whole blocks. (The full sync test passed in 5h46m, previous times were around 5h50m - 6h.) |
4a9a223
to
cb0ee0c
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.
Looks good, I'll leave the unresolved conversation to be sure it's not merged yet
The (I've added a conversation that explains why we're not merging yet.) |
Prefix iteration caused database hangs.
Also: - re-write disk read API to avoid iterator hangs - move disk read API to ReadDisk - re-write impl rocksdb::AsColumnFamilyRef to a where clause, for consistency
26a4de5
to
4a047a6
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.
Re-approving
* ZIPs were updated to remove ambiguity, this was tracked in #1267. * #2105 was fixed by #3039 and #2379 was closed by #3069 * #2230 was a duplicate of #2231 which was closed by #2511 * #3235 was obsoleted by #2156 which was fixed by #3505 * #1850 was fixed by #2944, #1851 was fixed by #2961 and #2902 was fixed by #2969 * We migrated to Rust 2021 edition in Jan 2022 with #3332 * #1631 was closed as not needed * #338 was fixed by #3040 and #1162 was fixed by #3067 * #2079 was fixed by #2445 * #4794 was fixed by #6122 * #1678 stopped being an issue * #3151 was fixed by #3934 * #3204 was closed as not needed * #1213 was fixed by #4586 * #1774 was closed as not needed * #4633 was closed as not needed * Clarify behaviour of difficulty spacing Co-authored-by: teor <teor@riseup.net> * Update comment to reflect implemented behaviour Co-authored-by: teor <teor@riseup.net> * Update comment to reflect implemented behaviour when retrying block downloads Co-authored-by: teor <teor@riseup.net> * Update `TODO` to remove closed issue and clarify when we might want to fix Co-authored-by: teor <teor@riseup.net> * Update `TODO` to remove closed issue and clarify what we might want to change in future Co-authored-by: teor <teor@riseup.net> * Clarify benefits of how we do block verification Co-authored-by: teor <teor@riseup.net> * Fix rustfmt errors --------- Co-authored-by: teor <teor@riseup.net>
Motivation
Currently, Zebra reads the entire block each time we lookup a transaction. But we want to serve transactions to
lightwalletd
quickly and efficiently.Consensus Rules
This PR adds the genesis transaction hash to the transaction indexes, so Zebra can re-create the genesis block from its header and transaction.
There is a consensus rule that prevents spends of the genesis transparent UTXO. This PR doesn't change the UTXO index, so Zebra's consensus behaviour remains the same.
Designs
The Blocks and Transactions parts of:
https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/rfcs/0005-state-updates.md#rocksdb-data-structures
Solution
Database Changes:
Related Database Changes:
(In future PRs, we might need to change the thread mode for hang or performance testing. So I left the generic thread mode code in this PR.)
Testing:
To make sure there are no more hang bugs, I've started a full sync test on commit fce2ffe:
https://github.com/ZcashFoundation/zebra/actions/runs/2026544541
Closes #3151.
Review
This PR is on the critical path for the lightwalletd work, so I've tagged it as a high priority.
I tagged Conrado as the reviewer, because this PR will conflict with the
ZebraDb::transaction
changes in PR #3908. (It's only a minor conflict.)Reviewer Checklist