diff --git a/api/test/deals.go b/api/test/deals.go index 4f710cb71..7a9454bae 100644 --- a/api/test/deals.go +++ b/api/test/deals.go @@ -203,8 +203,8 @@ func TestBatchDealInput(t *testing.T, b APIBuilder, blocktime time.Duration, sta return func() (sealiface.Config, error) { return sealiface.Config{ MaxWaitDealsSectors: 1, - MaxSealingSectors: 2, - MaxSealingSectorsForDeals: 3, + MaxSealingSectors: 1, + MaxSealingSectorsForDeals: 2, AlwaysKeepUnsealedCopy: true, }, nil }, nil diff --git a/extern/storage-sealing/garbage.go b/extern/storage-sealing/garbage.go index 398040e6e..9409dca36 100644 --- a/extern/storage-sealing/garbage.go +++ b/extern/storage-sealing/garbage.go @@ -38,6 +38,9 @@ func (m *Sealing) PledgeSector(ctx context.Context) (storage.SectorRef, error) { return storage.SectorRef{}, xerrors.Errorf("notifying sealer of the new sector: %w", err) } + // update stats early, fsm planner would do that async + m.stats.updateSector(cfg, m.minerSectorID(sid), UndefinedSectorState) + log.Infof("Creating CC sector %d", sid) return sectorID, m.sectors.Send(uint64(sid), SectorStartCC{ ID: sid, diff --git a/extern/storage-sealing/input.go b/extern/storage-sealing/input.go index 564afbc88..756770121 100644 --- a/extern/storage-sealing/input.go +++ b/extern/storage-sealing/input.go @@ -400,6 +400,9 @@ func (m *Sealing) tryCreateDealSector(ctx context.Context, sp abi.RegisteredSeal return xerrors.Errorf("initializing sector: %w", err) } + // update stats early, fsm planner would do that async + m.stats.updateSector(cfg, m.minerSectorID(sid), UndefinedSectorState) + log.Infow("Creating sector", "number", sid, "type", "deal", "proofType", sp) return m.sectors.Send(uint64(sid), SectorStart{ ID: sid, diff --git a/extern/storage-sealing/stats.go b/extern/storage-sealing/stats.go index e858519fd..2688d8494 100644 --- a/extern/storage-sealing/stats.go +++ b/extern/storage-sealing/stats.go @@ -45,6 +45,8 @@ func (ss *SectorStats) updateSector(cfg sealiface.Config, id abi.SectorID, st Se sealing := ss.curSealingLocked() staging := ss.curStagingLocked() + log.Debugw("sector stats", "sealing", sealing, "staging", staging) + if cfg.MaxSealingSectorsForDeals > 0 && // max sealing deal sector limit set preSealing >= cfg.MaxSealingSectorsForDeals && // we were over limit sealing < cfg.MaxSealingSectorsForDeals { // and we're below the limit now