Add a second premigration for nv17

This commit is contained in:
Aayush 2022-10-19 16:24:02 -04:00
parent 84050170b9
commit 3401ef6f02
2 changed files with 33 additions and 7 deletions

View File

@ -197,9 +197,14 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule {
Migration: UpgradeActorsV9,
PreMigrations: []stmgr.PreMigration{{
PreMigration: PreUpgradeActorsV9,
StartWithin: 180,
StartWithin: 240,
DontStartWithin: 60,
StopWithin: 5,
}, {
PreMigration: PreUpgradeActorsV9,
StartWithin: 15,
DontStartWithin: 10,
StopWithin: 5,
}},
Expensive: true,
},

View File

@ -115,7 +115,7 @@ var migrationsCmd = &cli.Command{
return err
}
ts1, err := cs.GetTipsetByHeight(ctx, blk.Height-180, migrationTs, false)
ts1, err := cs.GetTipsetByHeight(ctx, blk.Height-240, migrationTs, false)
if err != nil {
return err
}
@ -127,30 +127,51 @@ var migrationsCmd = &cli.Command{
return err
}
fmt.Println("completed round 1, took ", time.Since(startTime))
preMigration1Time := time.Since(startTime)
ts2, err := cs.GetTipsetByHeight(ctx, blk.Height-15, migrationTs, false)
if err != nil {
return err
}
startTime = time.Now()
err = filcns.PreUpgradeActorsV9(ctx, sm, cache, ts2.ParentState(), ts2.Height()-1, ts2)
if err != nil {
return err
}
preMigration2Time := time.Since(startTime)
startTime = time.Now()
newCid1, err := filcns.UpgradeActorsV9(ctx, sm, cache, nil, blk.ParentStateRoot, blk.Height-1, migrationTs)
if err != nil {
return err
}
fmt.Println("completed round actual (with cache), took ", time.Since(startTime))
fmt.Println("new cid", newCid1)
cachedMigrationTime := time.Since(startTime)
startTime = time.Now()
newCid2, err := filcns.UpgradeActorsV9(ctx, sm, nv15.NewMemMigrationCache(), nil, blk.ParentStateRoot, blk.Height-1, migrationTs)
if err != nil {
return err
}
fmt.Println("completed round actual (without cache), took ", time.Since(startTime))
fmt.Println("new cid", newCid2)
uncachedMigrationTime := time.Since(startTime)
if newCid1 != newCid2 {
return xerrors.Errorf("got different results with and without the cache: %s, %s", newCid1,
newCid2)
}
fmt.Println("new cid", newCid2)
fmt.Println("completed premigration 1, took ", preMigration1Time)
fmt.Println("completed premigration 2, took ", preMigration2Time)
fmt.Println("completed round actual (with cache), took ", cachedMigrationTime)
fmt.Println("completed round actual (without cache), took ", uncachedMigrationTime)
err = checkStateInvariants(ctx, blk.ParentStateRoot, newCid1, bs)
if err != nil {
return err