Merge pull request #7444 from filecoin-project/feat/ap-fail-retry

sealing: Recover sectors after failed AddPiece
This commit is contained in:
Łukasz Magiera 2021-10-07 03:18:15 +01:00 committed by GitHub
commit 1993efe201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

View File

@ -135,7 +135,11 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
// Sealing errors
AddPieceFailed: planOne(),
AddPieceFailed: planOne(
on(SectorRetryWaitDeals{}, WaitDeals),
apply(SectorStartPacking{}),
apply(SectorAddPiece{}),
),
SealPreCommit1Failed: planOne(
on(SectorRetrySealPreCommit1{}, PreCommit1),
),
@ -400,6 +404,8 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
return m.handleFinalizeSector, processed, nil
// Handled failure modes
case AddPieceFailed:
return m.handleAddPieceFailed, processed, nil
case SealPreCommit1Failed:
return m.handleSealPrecommit1Failed, processed, nil
case SealPreCommit2Failed:

View File

@ -98,6 +98,10 @@ type SectorAddPieceFailed struct{ error }
func (evt SectorAddPieceFailed) FormatError(xerrors.Printer) (next error) { return evt.error }
func (evt SectorAddPieceFailed) apply(si *SectorInfo) {}
type SectorRetryWaitDeals struct{}
func (evt SectorRetryWaitDeals) apply(si *SectorInfo) {}
type SectorStartPacking struct{}
func (evt SectorStartPacking) apply(*SectorInfo) {}

View File

@ -245,9 +245,7 @@ func (m *Sealing) handleAddPiece(ctx statemachine.Context, sector SectorInfo) er
}
func (m *Sealing) handleAddPieceFailed(ctx statemachine.Context, sector SectorInfo) error {
log.Errorf("No recovery plan for AddPiece failing")
// todo: cleanup sector / just go retry (requires adding offset param to AddPiece in sector-storage for this to be safe)
return nil
return ctx.Send(SectorRetryWaitDeals{})
}
func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, data storage.Data, deal api.PieceDealInfo) (api.SectorOffset, error) {

View File

@ -108,7 +108,7 @@ const (
func toStatState(st SectorState, finEarly bool) statSectorState {
switch st {
case UndefinedSectorState, Empty, WaitDeals, AddPiece:
case UndefinedSectorState, Empty, WaitDeals, AddPiece, AddPieceFailed:
return sstStaging
case Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, SubmitPreCommitBatch, PreCommitBatchWait, WaitSeed, Committing, CommitFinalize, FinalizeSector:
return sstSealing