Skip to content
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

change(scan): Use the on-disk database for keys and results #8036

Merged
merged 18 commits into from
Nov 30, 2023

Conversation

teor2345
Copy link
Collaborator

Motivation

This PR replaces the in-memory database with a database on disk.

Depends-On: #8031

Close #8019
The remaining checklist items in that ticket actually belong in other tickets.

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?
For significant changes:
  • Is there a summary in the CHANGELOG?
  • Can these changes be split into multiple PRs?

If a checkbox isn't relevant to the PR, mark it as done.

Specifications

The design is in ticket #8019.

Complex Code or Requirements

The "get all keys" code is a bit messy, we can fix it up after the MVP when we have a column family just for keys.

Solution

  • Implement database serialization for keys and results
  • Add key/birthday read and write methods
  • Add scanning result read and write methods
  • Spawn blocking database functions on a blocking async task

Testing

I updated the existing tests, and marked the functions that need tests with a TODO. We can do those tests in the PRs where we actually use those functions, because we might change how those functions work when we start using them.

Review

This is a routine scanner database change.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

Follow Up Work

And then:

@teor2345 teor2345 added C-enhancement Category: This is an improvement P-Medium ⚡ A-state Area: State / database changes A-blockchain-scanner Area: Blockchain scanner of shielded transactions labels Nov 30, 2023
@teor2345 teor2345 self-assigned this Nov 30, 2023
@teor2345 teor2345 requested a review from a team as a code owner November 30, 2023 03:34
@teor2345 teor2345 requested review from upbqdn and removed request for a team November 30, 2023 03:34
Base automatically changed from init-scanner-db to main November 30, 2023 12:59
@mergify mergify bot requested a review from a team as a code owner November 30, 2023 12:59
@oxarbitrage
Copy link
Contributor

After i approved #8031 and it gor merged the automatic rebase into main didnt worked very well. The commits were repeated and there were conflicts. I cherry picked the relevant commits and force pushed.

oxarbitrage
oxarbitrage previously approved these changes Nov 30, 2023
Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks GREAT!

@oxarbitrage
Copy link
Contributor

Unavailable gcloud service https://github.com/ZcashFoundation/zebra/actions/runs/7051128803/job/19193339040?pr=8036

Trying a refresh.

@oxarbitrage
Copy link
Contributor

@Mergifyio refresh

Copy link
Contributor

mergify bot commented Nov 30, 2023

refresh

✅ Pull request refreshed

@oxarbitrage
Copy link
Contributor

Refresh didn't worked so i sent a small doc change to trigger the CI again. d216d03

@mergify mergify bot merged commit db05845 into main Nov 30, 2023
129 checks passed
@mergify mergify bot deleted the scan-db-format branch November 30, 2023 21:27
@mpguerra mpguerra linked an issue Dec 4, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes C-enhancement Category: This is an improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement scanning results storage format feat(zebra-scan): Make the key storage database persistent
2 participants