Skip to content

Commit

Permalink
chore: output payload size to log
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Apr 22, 2024
1 parent 931a30d commit be539a1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion storageprovider/deal_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,9 @@ func (storageDealPorcess *StorageDealProcessImpl) HandleOff(ctx context.Context,
return storageDealPorcess.HandleError(ctx, deal, fmt.Errorf("fail to save deal to database: %v", err))
}
}
log.Infof("after publishing deal. piece cid: %s, payload size: %d", deal.Proposal.PieceCID, deal.PayloadSize)

log.Infof("register shard. deal:%d, proposalCid:%s, pieceCid:%s", deal.DealID, deal.ProposalCid, deal.Proposal.PieceCID)
log.Infof("register shard. deal: %d, proposalCid: %s, pieceCid: %s", deal.DealID, deal.ProposalCid, deal.Proposal.PieceCID)
// Register the deal data as a "shard" with the DAG store. Later it can be
// fetched from the DAG store during retrieval.
if err := storageDealPorcess.dagStore.RegisterShard(ctx, deal.Proposal.PieceCID, carFilePath, true, nil); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion storageprovider/direct_deal_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (ddp *DirectDealProvider) ImportDeals(ctx context.Context, dealParams *type
func (ddp *DirectDealProvider) importDeal(ctx context.Context, dealParam *types.DirectDealParam, cParams *commonParams) error {
deal, err := ddp.dealRepo.GetDealByAllocationID(ctx, dealParam.AllocationID)
if err == nil {
return fmt.Errorf("deal(%v) exist: %s", deal.ID, deal.State.String())
return fmt.Errorf("deal(%v) exist: %s", deal.AllocationID, deal.State.String())
}
if !errors.Is(err, repo.ErrNotFound) {
return err
Expand All @@ -116,6 +116,7 @@ func (ddp *DirectDealProvider) importDeal(ctx context.Context, dealParam *types.
if deal.PayloadSize == 0 {
return fmt.Errorf("payload size is 0")
}
directDealLog.Infof("deal piece cid: %s, allocation id: %d, payload size: %d", deal.PieceCID, deal.AllocationID, deal.PayloadSize)

if err := ddp.dealRepo.SaveDeal(ctx, deal); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion storageprovider/storage_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func (p *StorageProviderImpl) importDataForDeal(ctx context.Context, d *types.Mi
// "will fire VerifiedData for imported file
d.PiecePath = piecePath
d.MetadataPath = filestore.Path("")
log.Infof("deal %s piece path: %s", propCid, d.PiecePath)
log.Infof("deal %s piece path: %s, payload size: %v", propCid, d.PiecePath, carSize)

d.State = storagemarket.StorageDealReserveProviderFunds
d.PieceStatus = types.Undefine
Expand Down

0 comments on commit be539a1

Please sign in to comment.