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

Possible missing db migration between balance-check version and latest one #1177

Closed
KtorZ opened this issue Dec 13, 2019 · 1 comment
Closed
Assignees

Comments

@KtorZ
Copy link
Member

KtorZ commented Dec 13, 2019

Context

Information -
Version 2019.12.13 (git revision: 11f2698)
Platform All
Installation Source

Steps to Reproduce

  1. Start a wallet server using v2019-11-18, create a wallet, wait for a few block to sync...

  2. Quit

  3. Start a wallet on the same state dir using v2019-12-09 or v2019-12-13, wait for a first block to sync.

  4. (expected) everything is fine.

  5. (actual) 💥

SQLite3 returned ErrorConstraint while attempting to perform step: NOT NULL constraint failed: seq_state_backup.reward_xpub
[cardano-wallet.worker:Error:29] [2019-12-14 16:11:56.57 UTC] 822329c8: Worker has exited unexpectedly: SQLite3 returned ErrorConstraint while attempting to perform step: NOT NULL constraint failed: seq_state_backup.reward_xpub

Expected behavior

In the case of these 2 versions, a DB migration is actually impossible, because it needs access to the xprv to populate the DB.

In the general case going forward:

  • it should automatically migrate the wallet databases when possible.
  • the stake pools database can be cleared at startup and restored from scratch because there is no wallet-specific data there.
  • if not possible to migrate, it should fail to start with a good error message.
  • (perhaps) if the jormungandr version was updated, cardano-wallet launch should delete the chain directory.
  • only forwards migrations (not backwards) need be supported.

Actual behavior

  • As above

Resolution

  1. Implement clearing of stake pools database => Fix pool registration rollback #1201.
  2. Add automatic tests of DB migrations so that we don't release with a migration error => Add database migration test #1190.

QA

  1. Ability to migrate to newer versions should be tested in CI.
@KtorZ KtorZ added BUG? and removed BUG? labels Dec 13, 2019
@KtorZ KtorZ assigned rvl and KtorZ Dec 14, 2019
iohk-bors bot added a commit that referenced this issue Dec 20, 2019
1211: Split Servant API client code into Cardano.Wallet.Api.Client r=rvl a=rvl

Relates to #1177

# Overview

- Splits out part of PR #1139.
- The typed client code is useful outside of the CLI.


Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
iohk-bors bot added a commit that referenced this issue Dec 23, 2019
1211: Split Servant API client code into Cardano.Wallet.Api.Client r=rvl a=rvl

Relates to #1177

# Overview

- Splits out part of PR #1139.
- The typed client code is useful outside of the CLI.


Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
iohk-bors bot added a commit that referenced this issue Jan 18, 2020
1190: Add database migration test r=KtorZ a=rvl

Relates to #1177.

# Overview

Adds a migration test that can be run against different versions of the wallet.

The idea is to use an api client to set up the database on a wallet server running one version. Then start up the wallet server on the current version and use the api client to check the database.

All the possible upgrade paths from previous released versions to the current version _could_ be exhaustively tested. However, in this initial version, only the direct upgrade from each release to latest is tested.

At present the testing actions are quite basic. It first restores a wallet, migrates, then lists the wallets.

The migration tests are run as part of nightly CI.

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
iohk-bors bot added a commit that referenced this issue Jan 18, 2020
1190: Add database migration test r=KtorZ a=rvl

Relates to #1177.

# Overview

Adds a migration test that can be run against different versions of the wallet.

The idea is to use an api client to set up the database on a wallet server running one version. Then start up the wallet server on the current version and use the api client to check the database.

All the possible upgrade paths from previous released versions to the current version _could_ be exhaustively tested. However, in this initial version, only the direct upgrade from each release to latest is tested.

At present the testing actions are quite basic. It first restores a wallet, migrates, then lists the wallets.

The migration tests are run as part of nightly CI.

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
iohk-bors bot added a commit that referenced this issue Jan 18, 2020
1190: Add database migration test r=KtorZ a=rvl

Relates to #1177.

# Overview

Adds a migration test that can be run against different versions of the wallet.

The idea is to use an api client to set up the database on a wallet server running one version. Then start up the wallet server on the current version and use the api client to check the database.

All the possible upgrade paths from previous released versions to the current version _could_ be exhaustively tested. However, in this initial version, only the direct upgrade from each release to latest is tested.

At present the testing actions are quite basic. It first restores a wallet, migrates, then lists the wallets.

The migration tests are run as part of nightly CI.

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
iohk-bors bot added a commit that referenced this issue Jan 19, 2020
1190: Add database migration test r=KtorZ a=rvl

Relates to #1177.

# Overview

Adds a migration test that can be run against different versions of the wallet.

The idea is to use an api client to set up the database on a wallet server running one version. Then start up the wallet server on the current version and use the api client to check the database.

All the possible upgrade paths from previous released versions to the current version _could_ be exhaustively tested. However, in this initial version, only the direct upgrade from each release to latest is tested.

At present the testing actions are quite basic. It first restores a wallet, migrates, then lists the wallets.

The migration tests are run as part of nightly CI.

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
@piotr-iohk
Copy link
Contributor

Ok. there are automated migration tests in CI for Windows and Linux now.
Note that I couldn't test manually migration between v2019-11-18 and latest v2020-01-14 because supported Jormungandr versions (0.7.0 and 0.8.6 respectively) are not compatible.

The error is:

Jan 20 13:43:48.307 Parsing error on Block0
 |-> Structure invalid: Invalid config parameter tag
INFO[cardano-wallet.network:Error:19] [2020-01-20 12:43:49.59 UTC] Child process jormungandr exited with status 4
[cardano-wallet.application:Alert:19] [2020-01-20 12:43:49.59 UTC] The node exited with status ExitFailure 4

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

No branches or pull requests

3 participants