-
Notifications
You must be signed in to change notification settings - Fork 83
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
Do not delete target wallet, do not fail migration on item-error #1006
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1006 +/- ##
==========================================
- Coverage 30.39% 30.38% -0.02%
==========================================
Files 422 422
Lines 26227 26242 +15
Branches 5084 5085 +1
==========================================
+ Hits 7972 7973 +1
- Misses 16038 16051 +13
- Partials 2217 2218 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
73813f4
to
880734e
Compare
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
880734e
to
0659b2f
Compare
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
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.
While I understand that this helped in troubleshooting some issues (practically unrelated to the migration code) I think most changes (maybe apart from logging) should be reverted.
The fact that the migrator cleans up after itself on failure might not be a big deal for us, but it probably is for consumers that will use it.
Likewise, I don't think the migration should just continue on record errors. This is important data and I personally believe that anything that does not go well should be manually investigated and dealt with and the migration re-attempted afterwards, essentially succeeding only if everything is in order.
if let Err(e) = migration_res { | ||
close_wallet(dest_wallet_handle).await.ok(); | ||
delete_wallet(wallet_config).await.ok(); | ||
Err(LibvcxError::from_msg( | ||
LibvcxErrorKind::WalletMigrationFailed, | ||
e, | ||
)) | ||
} else { | ||
setup_wallet(dest_wallet_handle)?; | ||
close_wallet(src_wallet_handle).await?; | ||
Ok(()) | ||
} |
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.
Why not delete the destination wallet on failure?
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.
You should be able to rerun migration against the same target repeatedly, with predictable result. If I get IO error midway, I want to be able to retry.
if cache_record { | ||
self.cache.add(type_, &etype, &ename, &evalue, &etags); | ||
} |
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.
What is this change supposed to do? I see the flag is set to true
in both instances where this is used.
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.
In migration, the flag is set to false
.
info!( | ||
"Creating or opening target wallet {}", | ||
&wallet_config.wallet_name | ||
); |
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.
I think it will always attempt to create it.
If migration fails, you might want to inspect the wallet
If you fail on first error, you don't even get to know all the problem you have, only the first one. The changed approach in this PR provide flexibility to migrators. You can but don't have to be strict about failures, it's your call based on Also, I don't think there's at the moment other users of this migration other than us. George is already using credx. As the user of the migration code, these were practically useful changes I'd suggest to merge, although most of this will be anyways deleted in subsequent commits, as we remove vdrtools anoncreds. |
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
9865772
to
0c8a2a9
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.
I got mixed up in the files being modified and forgot the design of the migration. Given that this affects libvcx
stuff, I think the changes are then warranted. Thanks for clarifying!
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
This is set of changes to make the migration.
Changes: