Handle finalize failures in fsm

This commit is contained in:
zenground0 2022-03-02 09:33:33 -07:00 committed by Aayush
parent 5ac1c59527
commit 7073f31f84
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.SnapDealsDealsExpired},
{col: color.FgRed, state: sealing.ReplicaUpdateFailed}, {col: color.FgRed, state: sealing.ReplicaUpdateFailed},
{col: color.FgRed, state: sealing.ReleaseSectorKeyFailed}, {col: color.FgRed, state: sealing.ReleaseSectorKeyFailed},
{col: color.FgRed, state: sealing.FinalizeReplicaUpdateFailed},
} }
func init() { func init() {

View File

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

View File

@ -3,64 +3,65 @@ package sealing
type SectorState string type SectorState string
var ExistSectorStateList = map[SectorState]struct{}{ var ExistSectorStateList = map[SectorState]struct{}{
Empty: {}, Empty: {},
WaitDeals: {}, WaitDeals: {},
Packing: {}, Packing: {},
AddPiece: {}, AddPiece: {},
AddPieceFailed: {}, AddPieceFailed: {},
GetTicket: {}, GetTicket: {},
PreCommit1: {}, PreCommit1: {},
PreCommit2: {}, PreCommit2: {},
PreCommitting: {}, PreCommitting: {},
PreCommitWait: {}, PreCommitWait: {},
SubmitPreCommitBatch: {}, SubmitPreCommitBatch: {},
PreCommitBatchWait: {}, PreCommitBatchWait: {},
WaitSeed: {}, WaitSeed: {},
Committing: {}, Committing: {},
CommitFinalize: {}, CommitFinalize: {},
CommitFinalizeFailed: {}, CommitFinalizeFailed: {},
SubmitCommit: {}, SubmitCommit: {},
CommitWait: {}, CommitWait: {},
SubmitCommitAggregate: {}, SubmitCommitAggregate: {},
CommitAggregateWait: {}, CommitAggregateWait: {},
FinalizeSector: {}, FinalizeSector: {},
Proving: {}, Proving: {},
FailedUnrecoverable: {}, FailedUnrecoverable: {},
SealPreCommit1Failed: {}, SealPreCommit1Failed: {},
SealPreCommit2Failed: {}, SealPreCommit2Failed: {},
PreCommitFailed: {}, PreCommitFailed: {},
ComputeProofFailed: {}, ComputeProofFailed: {},
CommitFailed: {}, CommitFailed: {},
PackingFailed: {}, PackingFailed: {},
FinalizeFailed: {}, FinalizeFailed: {},
DealsExpired: {}, DealsExpired: {},
RecoverDealIDs: {}, RecoverDealIDs: {},
Faulty: {}, Faulty: {},
FaultReported: {}, FaultReported: {},
FaultedFinal: {}, FaultedFinal: {},
Terminating: {}, Terminating: {},
TerminateWait: {}, TerminateWait: {},
TerminateFinality: {}, TerminateFinality: {},
TerminateFailed: {}, TerminateFailed: {},
Removing: {}, Removing: {},
RemoveFailed: {}, RemoveFailed: {},
Removed: {}, Removed: {},
SnapDealsWaitDeals: {}, SnapDealsWaitDeals: {},
SnapDealsAddPiece: {}, SnapDealsAddPiece: {},
SnapDealsPacking: {}, SnapDealsPacking: {},
UpdateReplica: {}, UpdateReplica: {},
ProveReplicaUpdate: {}, ProveReplicaUpdate: {},
SubmitReplicaUpdate: {}, SubmitReplicaUpdate: {},
ReplicaUpdateWait: {}, ReplicaUpdateWait: {},
UpdateActivating: {}, UpdateActivating: {},
ReleaseSectorKey: {}, ReleaseSectorKey: {},
FinalizeReplicaUpdate: {}, FinalizeReplicaUpdate: {},
SnapDealsAddPieceFailed: {}, SnapDealsAddPieceFailed: {},
SnapDealsDealsExpired: {}, SnapDealsDealsExpired: {},
SnapDealsRecoverDealIDs: {}, SnapDealsRecoverDealIDs: {},
ReplicaUpdateFailed: {}, ReplicaUpdateFailed: {},
ReleaseSectorKeyFailed: {}, ReleaseSectorKeyFailed: {},
AbortUpgrade: {}, FinalizeReplicaUpdateFailed: {},
AbortUpgrade: {},
} }
// cmd/lotus-miner/info.go defines CLI colors corresponding to these states // cmd/lotus-miner/info.go defines CLI colors corresponding to these states
@ -124,12 +125,13 @@ const (
RecoverDealIDs SectorState = "RecoverDealIDs" RecoverDealIDs SectorState = "RecoverDealIDs"
// snap deals error modes // snap deals error modes
SnapDealsAddPieceFailed SectorState = "SnapDealsAddPieceFailed" SnapDealsAddPieceFailed SectorState = "SnapDealsAddPieceFailed"
SnapDealsDealsExpired SectorState = "SnapDealsDealsExpired" SnapDealsDealsExpired SectorState = "SnapDealsDealsExpired"
SnapDealsRecoverDealIDs SectorState = "SnapDealsRecoverDealIDs" SnapDealsRecoverDealIDs SectorState = "SnapDealsRecoverDealIDs"
AbortUpgrade SectorState = "AbortUpgrade" AbortUpgrade SectorState = "AbortUpgrade"
ReplicaUpdateFailed SectorState = "ReplicaUpdateFailed" ReplicaUpdateFailed SectorState = "ReplicaUpdateFailed"
ReleaseSectorKeyFailed SectorState = "ReleaseSectorKeyFailed" ReleaseSectorKeyFailed SectorState = "ReleaseSectorKeyFailed"
FinalizeReplicaUpdateFailed SectorState = "FinalizeReplicaUpdateFailed"
Faulty SectorState = "Faulty" // sector is corrupted or gone for some reason Faulty SectorState = "Faulty" // sector is corrupted or gone for some reason
FaultReported SectorState = "FaultReported" // sector has been declared as a fault on chain FaultReported SectorState = "FaultReported" // sector has been declared as a fault on chain