diff --git a/faults.go b/faults.go new file mode 100644 index 000000000..670de8793 --- /dev/null +++ b/faults.go @@ -0,0 +1,48 @@ +package sectorstorage + +import ( + "context" + + "golang.org/x/xerrors" + + "github.com/filecoin-project/sector-storage/stores" + "github.com/filecoin-project/specs-actors/actors/abi" +) + +// TODO: Track things more actively +type FaultTracker interface { + CheckProvable(ctx context.Context, spt abi.RegisteredProof, sectors []abi.SectorID) ([]abi.SectorID, error) +} + +// Returns unprovable sectors +func (m *Manager) CheckProvable(ctx context.Context, spt abi.RegisteredProof, sectors []abi.SectorID) ([]abi.SectorID, error) { + var bad []abi.SectorID + + // TODO: More better checks + for _, sector := range sectors { + err := func() error { + lp, _, done, err := m.localStore.AcquireSector(ctx, sector, spt, stores.FTSealed|stores.FTCache, stores.FTNone, false) + if err != nil { + return xerrors.Errorf("acquire sector in checkProvable: %w", err) + } + defer done() + + if lp.Sealed == "" || lp.Cache == "" { + log.Warnw("CheckProvable Sector FAULT: cache an/or sealed paths not found", "sector", sector, "sealed", lp.Sealed, "cache", lp.Cache) + bad = append(bad, sector) + return nil + } + + // must be fine + + return nil + }() + if err != nil { + return nil, err + } + } + + return bad, nil +} + +var _ FaultTracker = &Manager{} diff --git a/manager.go b/manager.go index 065370ed6..629d672bd 100644 --- a/manager.go +++ b/manager.go @@ -50,6 +50,7 @@ type SectorManager interface { ffiwrapper.StorageSealer storage.Prover + FaultTracker } type WorkerID uint64 diff --git a/mock/mock.go b/mock/mock.go index 1e3985be0..05e424307 100644 --- a/mock/mock.go +++ b/mock/mock.go @@ -288,6 +288,10 @@ func (mgr *SectorMgr) FinalizeSector(context.Context, abi.SectorID) error { return nil } +func (mgr *SectorMgr) CheckProvable(context.Context, abi.RegisteredProof, []abi.SectorID) ([]abi.SectorID, error) { + return nil, nil +} + func (m mockVerif) VerifySeal(svi abi.SealVerifyInfo) (bool, error) { if len(svi.OnChain.Proof) != 32 { // Real ones are longer, but this should be fine return false, nil diff --git a/resources.go b/resources.go index 23512b85c..7c281eda0 100644 --- a/resources.go +++ b/resources.go @@ -201,16 +201,16 @@ var ResourceTable = map[sealtasks.TaskType]map[abi.RegisteredProof]Resources{ Threads: -1, CanGPU: true, - BaseMinMemory: 128 << 30, // params + BaseMinMemory: 64 << 30, // params }, abi.RegisteredProof_StackedDRG32GiBSeal: Resources{ - MaxMemory: 130 << 30, + MaxMemory: 150 << 30, // TODO: ~30G of this should really be BaseMaxMemory MinMemory: 30 << 30, Threads: -1, CanGPU: true, - BaseMinMemory: 64 << 30, // params + BaseMinMemory: 32 << 30, // params }, abi.RegisteredProof_StackedDRG512MiBSeal: Resources{ MaxMemory: 3 << 29, // 1.5G