-
Notifications
You must be signed in to change notification settings - Fork 179
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
Add a migration which detects and filters out unreferenced slabs #5653
Add a migration which detects and filters out unreferenced slabs #5653
Conversation
cmd/util/ledger/migrations/filter_unreferenced_slabs_migration.go
Outdated
Show resolved
Hide resolved
@onflow/cadence PTAL 🙏 |
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.
Nice! I left a comment about needing to filter out child slabs and referenced slabs as well.
cmd/util/ledger/migrations/filter_unreferenced_slabs_migration.go
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/atree-inlining-cadence-v0.42 #5653 +/- ##
=========================================================================
+ Coverage 53.39% 64.65% +11.26%
=========================================================================
Files 16 91 +75
Lines 2270 12233 +9963
=========================================================================
+ Hits 1212 7909 +6697
- Misses 971 3624 +2653
- Partials 87 700 +613
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
ff4932d
to
b80a5da
Compare
Forgot we also need to still integrate this new migration into the whole pipeline. I guess it should be behind a flag, disabled by default? |
@turbolent It would be cleaner to have separate migrations fixing different problems if overhead is small.
We can make overhead small, e.g. by only fixing registers in the 9 testnet accounts. Also, if other accounts have these problems, then it might be better to be alerted about those instead of silently fixing them.
I agree.
Yes, that would be great. |
Integrated the new migration into the pipeline in commit 652410e. @fxamacker To avoid the overhead of grouping payloads by account, maybe we can add the discussed migration, another account-based migration, into this sub-pipeline: https://github.com/onflow/flow-go/pull/5653/files#diff-efc0583bcfd2aa19725211a31ed4ceed33b7d0ab5228c4ab533acf0d7f474d63R422-R424 |
@turbolent Yes, that was the plan. I will include the new migration in an existing account based migration when I open PR. |
@fxamacker Should I port this to |
@turbolent Not yet, I'm currently taking another look at this PR since it was updated. BTW, I just opened PR #5755 for new migration (to fix refs to nonexistent slabs) targeting stable-cadence. |
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.
Nice! 👍 LGTM!
It would be nice to write filtered slabs in payload file format (instead of JSON) to be consistent. However, current API to create payload file doesn't support incremental writes yet. We can revisit this aspect later if needed.
@turbolent Yes but If you don't have time, I can port this first thing in the morning (CDT). BTW, thanks for fast review on PR #5755! |
@fxamacker Can we use the reporter infrastructure to create a payloads file? Or do we have to create one payloads file per account? |
@turbolent No, the current reporter infrastructure can't create a payload file because it serializes received objects in JSON.
One payloads file per account might be overkill since we don't treat them differently. One approach to create payload files for unreferenced slabs in this migration is to:
This approach uses existing code and it doesn't break any API. Maybe report should only summarize by listing accounts having any unreferenced slabs (along with undreferenced slab count). Payload data can be in a payloads file instead of the report. |
@turbolent I opened PR #5758 to port this PR to |
…s/filtered accounts
@fxamacker How does 7e3d598 look? |
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.
Commit 7e3d598 looks good! Thanks for writing payloads to payload file.
I left some comments.
cmd/util/ledger/migrations/filter_unreferenced_slabs_migration.go
Outdated
Show resolved
Hide resolved
cmd/util/ledger/migrations/filter_unreferenced_slabs_migration.go
Outdated
Show resolved
Hide resolved
@fxamacker Addressed the feedback in f5a46ee and 52175ea. If they look good, we'll want to port them to #5758 |
@turbolent Updates look good! I ported new commits to #5758. |
…tree-inlining-cadence-v0.42 Port #5653 to feature/atree-inlining-cadence-v0.42 branch
Work towards #5634