Skip to content

Commit

Permalink
Merge pull request #5016 from filecoin-project/fix/fsm-rm-unceroverable
Browse files Browse the repository at this point in the history
storagefsm: Add missing planners
  • Loading branch information
magik6k authored Nov 26, 2020
2 parents 6df0340 + 74f040f commit 2304ea0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/lotus-storage-miner/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ var stateList = []stateMeta{

{col: color.FgRed, state: sealing.UndefinedSectorState},
{col: color.FgYellow, state: sealing.Packing},
{col: color.FgYellow, state: sealing.GetTicket},
{col: color.FgYellow, state: sealing.PreCommit1},
{col: color.FgYellow, state: sealing.PreCommit2},
{col: color.FgYellow, state: sealing.PreCommitting},
Expand Down
4 changes: 4 additions & 0 deletions extern/storage-sealing/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,12 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
on(SectorFaultReported{}, FaultReported),
),

FaultReported: final, // not really supported right now

FaultedFinal: final,
Removed: final,

FailedUnrecoverable: final,
}

func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(statemachine.Context, SectorInfo) error, uint64, error) {
Expand Down
15 changes: 15 additions & 0 deletions extern/storage-sealing/fsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,18 @@ func TestPlanCommittingHandlesSectorCommitFailed(t *testing.T) {

require.Equal(t, CommitFailed, m.state.State)
}

func TestPlannerList(t *testing.T) {
for state := range ExistSectorStateList {
_, ok := fsmPlanners[state]
require.True(t, ok, "state %s", state)
}

for state := range fsmPlanners {
if state == UndefinedSectorState {
continue
}
_, ok := ExistSectorStateList[state]
require.True(t, ok, "state %s", state)
}
}
3 changes: 2 additions & 1 deletion extern/storage-sealing/sector_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var ExistSectorStateList = map[SectorState]struct{}{
Empty: {},
WaitDeals: {},
Packing: {},
GetTicket: {},
PreCommit1: {},
PreCommit2: {},
PreCommitting: {},
Expand Down Expand Up @@ -75,7 +76,7 @@ const (

func toStatState(st SectorState) statSectorState {
switch st {
case Empty, WaitDeals, Packing, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, WaitSeed, Committing, CommitWait, FinalizeSector:
case Empty, WaitDeals, Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, WaitSeed, Committing, SubmitCommit, CommitWait, FinalizeSector:
return sstSealing
case Proving, Removed, Removing:
return sstProving
Expand Down

0 comments on commit 2304ea0

Please sign in to comment.