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

DB v1->v2 migration #3044

Merged
merged 4 commits into from
Sep 19, 2019
Merged

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Sep 17, 2019

Resolves #3043.

On startup reads all the full blocks from the local db and writes them back into the db using protocol v2.

We take advantage of the blocks iterator and simply attempt to read them in v1.
Subsequent reads will fail quickly (v2 reader will not successfully read v1 data) causing the iterator to terminate early so can be safely run multiple times.

Note: This PR is overly noisy right now as it is based on the branch for #3034.
Once #3034 is merged this PR will be rebased against master and should look a lot cleaner.

@antiochp antiochp marked this pull request as ready for review September 19, 2019 13:50
@antiochp
Copy link
Member Author

@DavidBurkett You suggested storing the db version somewhere so we easily know which version a particular node is using for its db.

I played around with doing this but decided this was not necessary right now. It may be something we want to introduce at a later date once versioning gets more complex (right now its just blocks and a simple old v1 vs. new v2).

Currently the rules are simply -

  • check if we have v1 blocks in the db (by attempting to read them via v1 deserialization)
  • if so, migrate them all to v2 and continue
  • a running node will always be in v2 (after the above migration)

@antiochp antiochp merged commit 1c072f5 into mimblewimble:master Sep 19, 2019
@antiochp antiochp deleted the db_v1_v2_migration branch September 19, 2019 20:00
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.

Variable size kernels: local db support and migration
1 participant