-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Implement pre-migration framework #5434
Conversation
5e0a35a
to
a93a186
Compare
migration := &migration{ | ||
upgrade: upgrade.Migration, | ||
preMigrations: upgrade.PreMigrations, | ||
cache: nv10.NewMemMigrationCache(), |
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.
a bit messy but I guess it is fine
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.
Yeah, we should probably move it elsewhere, but this works for now. Really, it was that or copy it.
This can significantly speedup state migrations.
This was really confusing.
Otherwise, we may end up referencing blocks we never wrote to disk.
This was causing a lot of warnings about not implementing View.
5aaf6af
to
56054b0
Compare
chain/stmgr/forks.go
Outdated
When: 120, | ||
NotAfter: 60, | ||
}, { | ||
PreMigration: PreUpgradeActorsV3, | ||
When: 30, | ||
NotAfter: 20, |
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.
Probably should get those epochs from build/
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.
Maybe? I mean, these are just saying "do the pre-migration N epochs before the upgrade height". I'm not sure if being able to configure these in the build is all that useful.
chain/stmgr/forks.go
Outdated
// TODO: tune this. | ||
config := nv10.Config{MaxWorkers: 1} |
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.
Do we have good/any idea on what this should be?
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'm setting the pre-migration to half the CPUs, and the migration to all the CPUs. I'll also try at 2x CPUs just to see if it matters.
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.
Can you take a look at the current values?
for _, head := range change { | ||
for len(schedule) > 0 { | ||
op := &schedule[0] | ||
if head.Val.Height() < op.after { |
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.
We could add some confidence here to make reverts less likely to have impact here (if they even matter)
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.
Reverts don't matter.
|
||
// Finally, when the head changes, see if there's anything we need to do. | ||
for change := range sm.cs.SubHeadChanges(ctx) { | ||
for _, head := range change { |
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.
Should we also drop the migration caches here after say upgradeEpoch+finality to not keep a bunch of stuff in memory?
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.
Hm. Yes, we should. I'll nil out the "ops" as we pass them.
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.
Well, actually, it's not quite that simple. I'll see if there's a better way to do this.
chain/stmgr/forks.go
Outdated
// When specifies that this pre-migration should be started at most When epochs before the upgrade. | ||
When abi.ChainEpoch | ||
|
||
// NotAfter specifies that this pre-migration should not be started NotAfter epochs before |
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.
It's a bit more than that, right -- it also means that an in-process migration will be cancelled at this epoch?
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.
Yeah, I'm going to to fix that. Really, we need three points in time:
- Start after.
- Don't start after.
- Stop at.
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.
Yeah, that sounds better
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.
Could you take a look now?
Co-authored-by: Aayush Rajasekaran <[email protected]>
There are now three times: 1. StartWithin: start within X epochs of the upgrade. 2. DontStartWithin: don't start within X epochs of the upgrade. 3. StopWithin: stop within X epochs of the upgrade.
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
This PR adds:
some number of epochs before the upgrade happens.
Finally, this PR wires up pre-migrations for the actors V3 upgrade.
fixes #5415
TODO: