From e17af657da447a921aae0b7a1516673d7829b2cd Mon Sep 17 00:00:00 2001 From: Aayush Date: Tue, 18 Jul 2023 09:03:19 -0400 Subject: [PATCH] chore: stmgr: migrations: do not log noisily on cache misses --- chain/stmgr/forks.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/chain/stmgr/forks.go b/chain/stmgr/forks.go index 1f9977d961d..9d59b542855 100644 --- a/chain/stmgr/forks.go +++ b/chain/stmgr/forks.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/binary" + "errors" "os" "sort" "strings" @@ -11,6 +12,7 @@ import ( "time" "github.com/ipfs/go-cid" + "github.com/ipfs/go-datastore" "golang.org/x/xerrors" "github.com/filecoin-project/go-address" @@ -177,11 +179,15 @@ func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, heig u := sm.stateMigrations[height] if u != nil && u.upgrade != nil { migCid, ok, err := u.migrationResultCache.Get(ctx, root) - if err == nil && ok { - log.Infow("CACHED migration", "height", height, "from", root, "to", migCid) - return migCid, nil - } else if err != nil { + if err == nil { + if ok { + log.Infow("CACHED migration", "height", height, "from", root, "to", migCid) + 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") } startTime := time.Now()