Skip to content

Commit

Permalink
chore: stmgr: migrations: do not log noisily on cache misses
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Jul 18, 2023
1 parent 3af9fde commit 867bd8e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions chain/stmgr/forks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import (
"bytes"
"context"
"encoding/binary"
"errors"
"os"
"sort"
"strings"
"sync"
"time"

"github.com/ipfs/go-datastore"

"github.com/ipfs/go-cid"
"golang.org/x/xerrors"

Expand Down Expand Up @@ -177,11 +180,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()
Expand Down

0 comments on commit 867bd8e

Please sign in to comment.