Handle finalize failures in fsm

This commit is contained in:
zenground0 2022-03-02 09:33:33 -07:00
parent 6d464c478e
commit 874124c4e7
3 changed files with 73 additions and 64 deletions

View File

@ -527,6 +527,7 @@ var stateList = []stateMeta{
{col: color.FgRed, state: sealing.SnapDealsDealsExpired},
{col: color.FgRed, state: sealing.ReplicaUpdateFailed},
{col: color.FgRed, state: sealing.ReleaseSectorKeyFailed},
{col: color.FgRed, state: sealing.FinalizeReplicaUpdateFailed},
}
func init() {

View File

@ -175,6 +175,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
),
FinalizeReplicaUpdate: planOne(
on(SectorFinalized{}, UpdateActivating),
on(SectorFinalizeFailed{}, FinalizeReplicaUpdateFailed),
),
UpdateActivating: planOne(
on(SectorUpdateActive{}, ReleaseSectorKey),
@ -267,6 +268,9 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
ReleaseSectorKeyFailed: planOne(
on(SectorUpdateActive{}, ReleaseSectorKey),
),
FinalizeReplicaUpdateFailed: planOne(
on(SectorRetryFinalize{}, FinalizeReplicaUpdate),
),
// Post-seal
@ -536,6 +540,8 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
return m.handleSubmitReplicaUpdateFailed, processed, nil
case ReleaseSectorKeyFailed:
return m.handleReleaseSectorKeyFailed, 0, err
case FinalizeReplicaUpdateFailed:
return m.handleFinalizeFailed, processed, nil
case AbortUpgrade:
return m.handleAbortUpgrade, processed, nil

View File

@ -60,6 +60,7 @@ var ExistSectorStateList = map[SectorState]struct{}{
SnapDealsRecoverDealIDs: {},
ReplicaUpdateFailed: {},
ReleaseSectorKeyFailed: {},
FinalizeReplicaUpdateFailed: {},
AbortUpgrade: {},
}
@ -130,6 +131,7 @@ const (
AbortUpgrade SectorState = "AbortUpgrade"
ReplicaUpdateFailed SectorState = "ReplicaUpdateFailed"
ReleaseSectorKeyFailed SectorState = "ReleaseSectorKeyFailed"
FinalizeReplicaUpdateFailed SectorState = "FinalizeReplicaUpdateFailed"
Faulty SectorState = "Faulty" // sector is corrupted or gone for some reason
FaultReported SectorState = "FaultReported" // sector has been declared as a fault on chain