From a6492b1ed6c51d42bf47708c201e13fbd4335340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 27 Aug 2020 23:59:01 +0200 Subject: [PATCH] storagefsm: Auto-retry failed remove --- extern/storage-sealing/fsm.go | 6 ++++++ extern/storage-sealing/states_failed.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/extern/storage-sealing/fsm.go b/extern/storage-sealing/fsm.go index 1f04abd56..4af860a54 100644 --- a/extern/storage-sealing/fsm.go +++ b/extern/storage-sealing/fsm.go @@ -143,6 +143,9 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto on(SectorRemoved{}, Removed), on(SectorRemoveFailed{}, RemoveFailed), ), + RemoveFailed: planOne( + // SectorRemove (global) + ), Faulty: planOne( on(SectorFaultReported{}, FaultReported), ), @@ -304,6 +307,9 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta case Removed: return nil, processed, nil + case RemoveFailed: + return m.handleRemoveFailed, processed, nil + // Faults case Faulty: return m.handleFaulty, processed, nil diff --git a/extern/storage-sealing/states_failed.go b/extern/storage-sealing/states_failed.go index 85744edd4..7b6a7a892 100644 --- a/extern/storage-sealing/states_failed.go +++ b/extern/storage-sealing/states_failed.go @@ -244,6 +244,14 @@ func (m *Sealing) handleFinalizeFailed(ctx statemachine.Context, sector SectorIn return ctx.Send(SectorRetryFinalize{}) } +func (m *Sealing) handleRemoveFailed(ctx statemachine.Context, sector SectorInfo) error { + if err := failedCooldown(ctx, sector); err != nil { + return err + } + + return ctx.Send(SectorRemove{}) +} + func (m *Sealing) handleDealsExpired(ctx statemachine.Context, sector SectorInfo) error { // First make vary sure the sector isn't committed si, err := m.api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, nil)