-
Notifications
You must be signed in to change notification settings - Fork 137
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
Improve dictionary key migration #3386
Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 7b7abe9 Collapsed results for better readability
|
…rating dictionary values" This reverts commit 943b9b3.
ensure dictionary keys with legacy representation are always re-stored even if migration is not necessary or migration failed, ensure the key is restored, so the key-value pair stays accessible, and inlining atree mutating iterator does not fail
496bc15
to
887c682
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.
👍
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.
LGTM! 👍 Thanks for adding a migration step for all legacy keys!
issue got resolved by onflow/cadence#3386
Work towards #3366
Description
Context: https://discord.com/channels/613813861610684416/1108479699732152503/1245434532572958791
Revert part of #3381. This approach does not work: When a new migration runs that does not migrate, after a previous migration that did migrate, then we can't just use the legacy key as a lookup – the key has not been migrated in the current migration, but it is in migrated form.
Improve the migration of dictionary keys that have a legacy representation: Introduce a new migration,
TypeKeyMigration
, that re-storesType
values as-is, if they appear as dictionary keys. This migration is meant to be run after the existing migrations that updateType
values, i.e. the static type migration and entitlements migration. The migration ensures that type values used as dictionary keys are stored under their new hash, even if a prior migration failed to do so. That way the key-value pair stays accessible, and the mutating iterator of the inlining-version of atree does not fail when iterating over the migrated dictionary.I tested this will also work on
feature/atree-register-inlining-v1.0
and in flow-gomaster
.master
branchFiles changed
in the Github PR explorer