Merge pull request #7905 from filecoin-project/feat/snap-deals-add-ons
StartEpochSealingBuffer triggers packing on timer
This commit is contained in:
commit
7319420c8f
@ -167,6 +167,14 @@
|
|||||||
# env var: LOTUS_DEALMAKING_EXPECTEDSEALDURATION
|
# env var: LOTUS_DEALMAKING_EXPECTEDSEALDURATION
|
||||||
#ExpectedSealDuration = "24h0m0s"
|
#ExpectedSealDuration = "24h0m0s"
|
||||||
|
|
||||||
|
# Whether new sectors are created to pack incoming deals
|
||||||
|
# When this is set to false no new sectors will be created for sealing incoming deals
|
||||||
|
# This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade
|
||||||
|
#
|
||||||
|
# type: bool
|
||||||
|
# env var: LOTUS_DEALMAKING_MAKENEWSECTORFORDEALS
|
||||||
|
#MakeNewSectorForDeals = true
|
||||||
|
|
||||||
# Maximum amount of time proposed deal StartEpoch can be in future
|
# Maximum amount of time proposed deal StartEpoch can be in future
|
||||||
#
|
#
|
||||||
# type: Duration
|
# type: Duration
|
||||||
|
23
extern/storage-sealing/input.go
vendored
23
extern/storage-sealing/input.go
vendored
@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
|
"github.com/filecoin-project/lotus/build"
|
||||||
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
|
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
|
||||||
@ -117,9 +118,25 @@ func (m *Sealing) maybeStartSealing(ctx statemachine.Context, sector SectorInfo,
|
|||||||
return false, xerrors.Errorf("getting storage config: %w", err)
|
return false, xerrors.Errorf("getting storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo check deal age, start sealing if any deal has less than X (configurable) to start deadline
|
|
||||||
sealTime := time.Unix(sector.CreationTime, 0).Add(cfg.WaitDealsDelay)
|
sealTime := time.Unix(sector.CreationTime, 0).Add(cfg.WaitDealsDelay)
|
||||||
|
|
||||||
|
// check deal age, start sealing when the deal closest to starting is within slack time
|
||||||
|
_, current, err := m.Api.ChainHead(ctx.Context())
|
||||||
|
blockTime := time.Second * time.Duration(build.BlockDelaySecs)
|
||||||
|
if err != nil {
|
||||||
|
return false, xerrors.Errorf("API error getting head: %w", err)
|
||||||
|
}
|
||||||
|
for _, piece := range sector.Pieces {
|
||||||
|
if piece.DealInfo == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dealSafeSealEpoch := piece.DealInfo.DealProposal.StartEpoch - cfg.StartEpochSealingBuffer
|
||||||
|
dealSafeSealTime := time.Now().Add(time.Duration(dealSafeSealEpoch-current) * blockTime)
|
||||||
|
if dealSafeSealTime.Before(sealTime) {
|
||||||
|
sealTime = dealSafeSealTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if now.After(sealTime) {
|
if now.After(sealTime) {
|
||||||
log.Infow("starting to seal deal sector", "sector", sector.SectorNumber, "trigger", "wait-timeout")
|
log.Infow("starting to seal deal sector", "sector", sector.SectorNumber, "trigger", "wait-timeout")
|
||||||
return true, ctx.Send(SectorStartPacking{})
|
return true, ctx.Send(SectorStartPacking{})
|
||||||
@ -475,6 +492,10 @@ func (m *Sealing) tryCreateDealSector(ctx context.Context, sp abi.RegisteredSeal
|
|||||||
return xerrors.Errorf("getting storage config: %w", err)
|
return xerrors.Errorf("getting storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !cfg.MakeNewSectorForDeals {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if cfg.MaxSealingSectorsForDeals > 0 && m.stats.curSealing() >= cfg.MaxSealingSectorsForDeals {
|
if cfg.MaxSealingSectorsForDeals > 0 && m.stats.curSealing() >= cfg.MaxSealingSectorsForDeals {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
2
extern/storage-sealing/sealiface/config.go
vendored
2
extern/storage-sealing/sealiface/config.go
vendored
@ -18,6 +18,8 @@ type Config struct {
|
|||||||
// includes failed, 0 = no limit
|
// includes failed, 0 = no limit
|
||||||
MaxSealingSectorsForDeals uint64
|
MaxSealingSectorsForDeals uint64
|
||||||
|
|
||||||
|
MakeNewSectorForDeals bool
|
||||||
|
|
||||||
WaitDealsDelay time.Duration
|
WaitDealsDelay time.Duration
|
||||||
|
|
||||||
CommittedCapacitySectorLifetime time.Duration
|
CommittedCapacitySectorLifetime time.Duration
|
||||||
|
@ -156,6 +156,7 @@ func DefaultStorageMiner() *StorageMiner {
|
|||||||
ConsiderVerifiedStorageDeals: true,
|
ConsiderVerifiedStorageDeals: true,
|
||||||
ConsiderUnverifiedStorageDeals: true,
|
ConsiderUnverifiedStorageDeals: true,
|
||||||
PieceCidBlocklist: []cid.Cid{},
|
PieceCidBlocklist: []cid.Cid{},
|
||||||
|
MakeNewSectorForDeals: true,
|
||||||
// TODO: It'd be nice to set this based on sector size
|
// TODO: It'd be nice to set this based on sector size
|
||||||
MaxDealStartDelay: Duration(time.Hour * 24 * 14),
|
MaxDealStartDelay: Duration(time.Hour * 24 * 14),
|
||||||
ExpectedSealDuration: Duration(time.Hour * 24),
|
ExpectedSealDuration: Duration(time.Hour * 24),
|
||||||
|
@ -239,6 +239,14 @@ Default value: 1 minute.`,
|
|||||||
Comment: `Maximum expected amount of time getting the deal into a sealed sector will take
|
Comment: `Maximum expected amount of time getting the deal into a sealed sector will take
|
||||||
This includes the time the deal will need to get transferred and published
|
This includes the time the deal will need to get transferred and published
|
||||||
before being assigned to a sector`,
|
before being assigned to a sector`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "MakeNewSectorForDeals",
|
||||||
|
Type: "bool",
|
||||||
|
|
||||||
|
Comment: `Whether new sectors are created to pack incoming deals
|
||||||
|
When this is set to false no new sectors will be created for sealing incoming deals
|
||||||
|
This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "MaxDealStartDelay",
|
Name: "MaxDealStartDelay",
|
||||||
|
@ -120,6 +120,10 @@ type DealmakingConfig struct {
|
|||||||
// This includes the time the deal will need to get transferred and published
|
// This includes the time the deal will need to get transferred and published
|
||||||
// before being assigned to a sector
|
// before being assigned to a sector
|
||||||
ExpectedSealDuration Duration
|
ExpectedSealDuration Duration
|
||||||
|
// Whether new sectors are created to pack incoming deals
|
||||||
|
// When this is set to false no new sectors will be created for sealing incoming deals
|
||||||
|
// This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade
|
||||||
|
MakeNewSectorForDeals bool
|
||||||
// Maximum amount of time proposed deal StartEpoch can be in future
|
// Maximum amount of time proposed deal StartEpoch can be in future
|
||||||
MaxDealStartDelay Duration
|
MaxDealStartDelay Duration
|
||||||
// When a deal is ready to publish, the amount of time to wait for more
|
// When a deal is ready to publish, the amount of time to wait for more
|
||||||
|
@ -925,6 +925,8 @@ func ToSealingConfig(cfg *config.StorageMiner) sealiface.Config {
|
|||||||
MaxWaitDealsSectors: cfg.Sealing.MaxWaitDealsSectors,
|
MaxWaitDealsSectors: cfg.Sealing.MaxWaitDealsSectors,
|
||||||
MaxSealingSectors: cfg.Sealing.MaxSealingSectors,
|
MaxSealingSectors: cfg.Sealing.MaxSealingSectors,
|
||||||
MaxSealingSectorsForDeals: cfg.Sealing.MaxSealingSectorsForDeals,
|
MaxSealingSectorsForDeals: cfg.Sealing.MaxSealingSectorsForDeals,
|
||||||
|
StartEpochSealingBuffer: abi.ChainEpoch(cfg.Dealmaking.StartEpochSealingBuffer),
|
||||||
|
MakeNewSectorForDeals: cfg.Dealmaking.MakeNewSectorForDeals,
|
||||||
CommittedCapacitySectorLifetime: time.Duration(cfg.Sealing.CommittedCapacitySectorLifetime),
|
CommittedCapacitySectorLifetime: time.Duration(cfg.Sealing.CommittedCapacitySectorLifetime),
|
||||||
WaitDealsDelay: time.Duration(cfg.Sealing.WaitDealsDelay),
|
WaitDealsDelay: time.Duration(cfg.Sealing.WaitDealsDelay),
|
||||||
AlwaysKeepUnsealedCopy: cfg.Sealing.AlwaysKeepUnsealedCopy,
|
AlwaysKeepUnsealedCopy: cfg.Sealing.AlwaysKeepUnsealedCopy,
|
||||||
@ -950,8 +952,6 @@ func ToSealingConfig(cfg *config.StorageMiner) sealiface.Config {
|
|||||||
TerminateBatchMax: cfg.Sealing.TerminateBatchMax,
|
TerminateBatchMax: cfg.Sealing.TerminateBatchMax,
|
||||||
TerminateBatchMin: cfg.Sealing.TerminateBatchMin,
|
TerminateBatchMin: cfg.Sealing.TerminateBatchMin,
|
||||||
TerminateBatchWait: time.Duration(cfg.Sealing.TerminateBatchWait),
|
TerminateBatchWait: time.Duration(cfg.Sealing.TerminateBatchWait),
|
||||||
|
|
||||||
StartEpochSealingBuffer: abi.ChainEpoch(cfg.Dealmaking.StartEpochSealingBuffer),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user