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 db9fe72
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions chain/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ 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"
Expand Down Expand Up @@ -1183,6 +1184,9 @@ func (cs *ChainStore) Export(ctx context.Context, ts *types.TipSet, inclRecentRo
}

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

log.Infow("export started")

walkChain := func(blk cid.Cid) error {
if !seen.Visit(blk) {
Expand All @@ -1203,6 +1207,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 +1270,8 @@ func (cs *ChainStore) Export(ctx context.Context, ts *types.TipSet, inclRecentRo
}
}

log.Infow("export finished")

return nil
}

Expand Down

0 comments on commit db9fe72

Please sign in to comment.