Skip to content

Commit

Permalink
storagefsm: More logging for deal test debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Jan 21, 2021
1 parent 4601d96 commit 3ce30b6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions extern/storage-sealing/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) e
m.inputLk.Unlock()

// we send another SectorStartPacking in case one was sent in the handleAddPiece state
log.Infow("starting to seal deal sector", "sector", sector.SectorNumber, "trigger", "wait-timeout")
return ctx.Send(SectorStartPacking{})
}
}
Expand All @@ -44,6 +45,7 @@ func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) e

if len(sector.dealIDs()) >= maxDeals {
// can't accept more deals
log.Infow("starting to seal deal sector", "sector", sector.SectorNumber, "trigger", "maxdeals")
return ctx.Send(SectorStartPacking{})
}

Expand All @@ -54,6 +56,7 @@ func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) e

if used.Padded() == abi.PaddedPieceSize(ssize) {
// sector full
log.Infow("starting to seal deal sector", "sector", sector.SectorNumber, "trigger", "filled")
return ctx.Send(SectorStartPacking{})
}

Expand All @@ -69,10 +72,13 @@ func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) e

if now.After(sealTime) {
m.inputLk.Unlock()
log.Infow("starting to seal deal sector", "sector", sector.SectorNumber, "trigger", "wait-timeout")
return ctx.Send(SectorStartPacking{})
}

m.sectorTimers[m.minerSectorID(sector.SectorNumber)] = time.AfterFunc(sealTime.Sub(now), func() {
log.Infow("starting to seal deal sector", "sector", sector.SectorNumber, "trigger", "wait-timer")

if err := ctx.Send(SectorStartPacking{}); err != nil {
log.Errorw("sending SectorStartPacking event failed", "sector", sector.SectorNumber, "error", err)
}
Expand Down Expand Up @@ -175,6 +181,8 @@ func (m *Sealing) handleAddPiece(ctx statemachine.Context, sector SectorInfo) er
})
}

time.Sleep(1 * time.Second) // TODO: deal tests are unhappy without this

ppi, err := m.sealer.AddPiece(sectorstorage.WithPriority(ctx.Context(), DealSectorPriority),
m.minerSector(sector.SectorType, sector.SectorNumber),
pieceSizes,
Expand All @@ -186,6 +194,8 @@ func (m *Sealing) handleAddPiece(ctx statemachine.Context, sector SectorInfo) er
return ctx.Send(SectorAddPieceFailed{err})
}

log.Infow("deal added to a sector", "deal", deal.deal.DealID, "sector", sector.SectorNumber, "piece", ppi.PieceCID)

deal.accepted(sector.SectorNumber, offset, nil)

offset += deal.size
Expand Down

0 comments on commit 3ce30b6

Please sign in to comment.