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

blockchain: Make ver 5 to 6 db upgrades work again. #2446

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Oct 23, 2020

This allows version 5 to 6 database upgrades to work again by implementing code that is independent of the main code and works with the data structures as they existed in the version 5 database.

While here, it also updates some other cases in both older and newer upgrade code to make the upgrades stable even if the primary code changes.

A high-level overview of the key changes is:

  • Clear the failed validation status of the v2 block index entries directly instead of loading the code into the main index, modifying it, and flushing it
  • Avoid using the unversioned main funcs related to serializing and deserializing the spend journal
  • Implement code to directly create a script source from a v2 spend journal entry
  • Reimplement the migration code that initializes the v2 GCS filters to independently read the block tree and discover the main chain

@davecgh davecgh added this to the 1.6.0 milestone Oct 23, 2020
@davecgh davecgh added database upgrade Issues and/or pull requests that involve a new database version. and removed database upgrade Issues and/or pull requests that involve a new database version. labels Oct 23, 2020
Copy link
Member

@matheusd matheusd left a comment

Choose a reason for hiding this comment

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

Tested by syncing a few testnet blocks using a v1.4.0 binary, then performing the migration.

I also spot checked a few filters by running getcfilterv2 on the upgraded node and on new nodes.

Just found two small typos.

blockchain/upgrade.go Outdated Show resolved Hide resolved
blockchain/upgrade.go Outdated Show resolved Hide resolved
This allows version 5 to 6 database upgrades to work again by
implementing code that is independent of the main code and works with
the data structures as they existed in the version 5 database.

While here, it also updates some other cases in both older and newer
upgrade code to make the upgrades stable even if the primary code
changes.

An high-level overview of the key changes is:

- Clear the failed validation status of the v2 block index entries
  directly instead of loading the code into the main index, modifying
  it, and flushing it
- Avoid using the unversioned main funcs related to serializing and
  deserializing the spend journal
- Implement code to directly create a script source from a v2 spend
  journal entry
- Reimplement the migration code that initializes the v2 GCS filters to
  independently read the block tree and discover the main chain
@davecgh davecgh force-pushed the blockchain_correct_v5_to_v6_upgrade branch from 16ed00c to c1d3c8c Compare October 27, 2020 15:21
@davecgh davecgh merged commit c1d3c8c into decred:master Oct 27, 2020
@davecgh davecgh deleted the blockchain_correct_v5_to_v6_upgrade branch October 27, 2020 15: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.

None yet

3 participants