storagefsm: Update sector stats atomically with sector creation
This commit is contained in:
parent
679f5f7661
commit
e5b5bf1c1b
@ -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
|
||||
|
3
extern/storage-sealing/garbage.go
vendored
3
extern/storage-sealing/garbage.go
vendored
@ -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,
|
||||
|
3
extern/storage-sealing/input.go
vendored
3
extern/storage-sealing/input.go
vendored
@ -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,
|
||||
|
2
extern/storage-sealing/stats.go
vendored
2
extern/storage-sealing/stats.go
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user