Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

fix: dead loop on removing a sector #200

Merged
merged 1 commit into from
Mar 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion storage-sealing/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ var fsmPlanners = map[types.SectorState]func(events []statemachine.Event, state
types.FaultReported: final, // not really supported right now

types.FaultedFinal: final,
types.Removed: final,
types.Removed: finalRemoved,

types.FailedUnrecoverable: final,
}
Expand Down Expand Up @@ -690,6 +690,12 @@ func final(events []statemachine.Event, state *types.SectorInfo) (uint64, error)
return 0, xerrors.Errorf("didn't expect any events in state %s, got %+v", state.State, events)
}

// as sector has been removed, it's no needs to care about later events,
// just returns length of events as `processed` is ok.
func finalRemoved(events []statemachine.Event, _ *types.SectorInfo) (uint64, error) {
return uint64(len(events)), nil
}

func on(mut mutator, next types.SectorState) func() (mutator, func(*types.SectorInfo) (bool, error)) {
return func() (mutator, func(*types.SectorInfo) (bool, error)) {
return mut, func(state *types.SectorInfo) (bool, error) {
Expand Down