Skip to content

Commit

Permalink
add time around add index
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense committed May 16, 2023
1 parent df71713 commit bfa61f1
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions cmd/boostd/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ func processPiece(ctx context.Context, sectorid abi.SectorNumber, chainDealID ab
if !ignoreLID { // populate LID
var shouldGenerateNewDeal bool

var di model.DealInfo

if dr.HaveBoostDealsAndPieceStore { // successfully loaded boost sqlite db and piece store => try to infer dealinfo
// find the deal corresponding to the deal info's DealID
proposalCid, okLegacy := dr.PropCidByChainDealID[chainDealID]
Expand All @@ -608,7 +610,7 @@ func processPiece(ctx context.Context, sectorid abi.SectorNumber, chainDealID ab
isLegacy = true
}

di := model.DealInfo{
di = model.DealInfo{
DealUuid: uuid,
IsLegacy: isLegacy,
ChainDealID: chainDealID,
Expand All @@ -617,20 +619,13 @@ func processPiece(ctx context.Context, sectorid abi.SectorNumber, chainDealID ab
PieceOffset: offset.Padded(),
PieceLength: piecesize,
}

err = pd.AddDealForPiece(ctx, piececid, di)
if err != nil {
logger.Errorw("cant add deal info for piece", "piececid", piececid, "chain-deal-id", chainDealID, "err", err)

return err
}
}
}

if !dr.HaveBoostDealsAndPieceStore || shouldGenerateNewDeal { // missing boost sqlite db and piece store, so generate new dealinfo
// in the future we could also regenerate boost db sqlite??

di := model.DealInfo{
di = model.DealInfo{
DealUuid: uuid.NewString(),
IsLegacy: false,
ChainDealID: chainDealID,
Expand All @@ -639,14 +634,18 @@ func processPiece(ctx context.Context, sectorid abi.SectorNumber, chainDealID ab
PieceOffset: offset.Padded(),
PieceLength: piecesize,
}
}

err = pd.AddDealForPiece(ctx, piececid, di)
if err != nil {
logger.Errorw("cant add deal info for piece", "piececid", piececid, "chain-deal-id", chainDealID, "err", err)
timeAddIndex := time.Now()

return err
}
err = pd.AddDealForPiece(ctx, piececid, di)
if err != nil {
logger.Errorw("cant add deal info for piece", "piececid", piececid, "chain-deal-id", chainDealID, "err", err)

return err
}

logger.Infow("added index", "took", time.Since(timeAddIndex), "sector", di.SectorID, "piececid", piececid, "chain-deal-id", di.ChainDealID, "uuid", di.DealUuid)
}

if !ignoreCommp { // commp over data reader
Expand Down

0 comments on commit bfa61f1

Please sign in to comment.