Skip to content

Commit

Permalink
add logging to chain export
Browse files Browse the repository at this point in the history
  • Loading branch information
travisperson committed Sep 25, 2020
1 parent 3491e7b commit b392e33
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions chain/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import (

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/util/adt"

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/vm"
"github.com/filecoin-project/lotus/journal"
bstore "github.com/filecoin-project/lotus/lib/blockstore"
Expand Down Expand Up @@ -1183,6 +1185,10 @@ func (cs *ChainStore) Export(ctx context.Context, ts *types.TipSet, inclRecentRo
}

blocksToWalk := ts.Cids()
currentMinHeight := ts.Height()

log.Infow("export started")
exportStart := build.Clock.Now()

walkChain := func(blk cid.Cid) error {
if !seen.Visit(blk) {
Expand All @@ -1203,6 +1209,13 @@ func (cs *ChainStore) Export(ctx context.Context, ts *types.TipSet, inclRecentRo
return xerrors.Errorf("unmarshaling block header (cid=%s): %w", blk, err)
}

if currentMinHeight > b.Height {
currentMinHeight = b.Height
if currentMinHeight%builtin.EpochsInDay == 0 {
log.Infow("export", "height", currentMinHeight)
}
}

var cids []cid.Cid
if !skipOldMsgs || b.Height > ts.Height()-inclRecentRoots {
mcids, err := recurseLinks(cs.bs, walked, b.Messages, []cid.Cid{b.Messages})
Expand Down Expand Up @@ -1259,6 +1272,8 @@ func (cs *ChainStore) Export(ctx context.Context, ts *types.TipSet, inclRecentRo
}
}

log.Infow("export finished", "duration", build.Clock.Now().Sub(exportStart).Seconds())

return nil
}

Expand Down

0 comments on commit b392e33

Please sign in to comment.