v1.27.0-a #10
@ -178,18 +178,16 @@ func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, heig
|
|||||||
retCid := root
|
retCid := root
|
||||||
u := sm.stateMigrations[height]
|
u := sm.stateMigrations[height]
|
||||||
if u != nil && u.upgrade != nil {
|
if u != nil && u.upgrade != nil {
|
||||||
if height != build.UpgradeWatermelonFixHeight {
|
migCid, ok, err := u.migrationResultCache.Get(ctx, root)
|
||||||
migCid, ok, err := u.migrationResultCache.Get(ctx, root)
|
if err == nil {
|
||||||
if err == nil {
|
if ok {
|
||||||
if ok {
|
log.Infow("CACHED migration", "height", height, "from", root, "to", migCid)
|
||||||
log.Infow("CACHED migration", "height", height, "from", root, "to", migCid)
|
return migCid, nil
|
||||||
return migCid, nil
|
|
||||||
}
|
|
||||||
} else if !errors.Is(err, datastore.ErrNotFound) {
|
|
||||||
log.Errorw("failed to lookup previous migration result", "err", err)
|
|
||||||
} else {
|
|
||||||
log.Debug("no cached migration found, migrating from scratch")
|
|
||||||
}
|
}
|
||||||
|
} else if !errors.Is(err, datastore.ErrNotFound) {
|
||||||
|
log.Errorw("failed to lookup previous migration result", "err", err)
|
||||||
|
} else {
|
||||||
|
log.Debug("no cached migration found, migrating from scratch")
|
||||||
}
|
}
|
||||||
|
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
@ -197,7 +195,6 @@ func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, heig
|
|||||||
// Yes, we clone the cache, even for the final upgrade epoch. Why? Reverts. We may
|
// Yes, we clone the cache, even for the final upgrade epoch. Why? Reverts. We may
|
||||||
// have to migrate multiple times.
|
// have to migrate multiple times.
|
||||||
tmpCache := u.cache.Clone()
|
tmpCache := u.cache.Clone()
|
||||||
var err error
|
|
||||||
retCid, err = u.upgrade(ctx, sm, tmpCache, cb, root, height, ts)
|
retCid, err = u.upgrade(ctx, sm, tmpCache, cb, root, height, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorw("FAILED migration", "height", height, "from", root, "error", err)
|
log.Errorw("FAILED migration", "height", height, "from", root, "error", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user