Merge pull request #7256 from filecoin-project/fix/finearly-accounting

sealing: Fix sector state accounting with FinalizeEarly
This commit is contained in:
Łukasz Magiera 2021-09-02 19:56:45 +02:00 committed by GitHub
commit 4659b9207c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -106,11 +106,19 @@ const (
Removed SectorState = "Removed"
)
func toStatState(st SectorState) statSectorState {
func toStatState(st SectorState, finEarly bool) statSectorState {
switch st {
case UndefinedSectorState, Empty, WaitDeals, AddPiece:
return sstStaging
case Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, SubmitPreCommitBatch, PreCommitBatchWait, WaitSeed, Committing, CommitFinalize, SubmitCommit, CommitWait, SubmitCommitAggregate, CommitAggregateWait, FinalizeSector:
case Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, SubmitPreCommitBatch, PreCommitBatchWait, WaitSeed, Committing, CommitFinalize, FinalizeSector:
return sstSealing
case SubmitCommit, CommitWait, SubmitCommitAggregate, CommitAggregateWait:
if finEarly {
// we use statSectorState for throttling storage use. With FinalizeEarly
// we can consider sectors in states after CommitFinalize as finalized, so
// that more sectors can enter the sealing pipeline (and later be aggregated together)
return sstProving
}
return sstSealing
case Proving, Removed, Removing, Terminating, TerminateWait, TerminateFinality, TerminateFailed:
return sstProving

View File

@ -37,7 +37,7 @@ func (ss *SectorStats) updateSector(cfg sealiface.Config, id abi.SectorID, st Se
ss.totals[oldst]--
}
sst := toStatState(st)
sst := toStatState(st, cfg.FinalizeEarly)
ss.bySector[id] = sst
ss.totals[sst]++