Merge pull request #11083 from filecoin-project/asr/shut-up

chore: stmgr: migrations: do not log noisily on cache misses
This commit is contained in:
Aayush Rajasekaran 2023-07-18 10:33:39 -04:00 committed by GitHub
commit 9e5e77b778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"context" "context"
"encoding/binary" "encoding/binary"
"errors"
"os" "os"
"sort" "sort"
"strings" "strings"
@ -11,6 +12,7 @@ import (
"time" "time"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-address" "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] u := sm.stateMigrations[height]
if u != nil && u.upgrade != nil { if u != nil && u.upgrade != nil {
migCid, ok, err := u.migrationResultCache.Get(ctx, root) migCid, ok, err := u.migrationResultCache.Get(ctx, root)
if err == nil && ok { if err == nil {
log.Infow("CACHED migration", "height", height, "from", root, "to", migCid) if ok {
return migCid, nil log.Infow("CACHED migration", "height", height, "from", root, "to", migCid)
} else if err != nil { return migCid, nil
}
} else if !errors.Is(err, datastore.ErrNotFound) {
log.Errorw("failed to lookup previous migration result", "err", err) 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()