Merge pull request #37 from filecoin-project/feat/veryverysimplefaultchecks
Very simple fault check function
This commit is contained in:
commit
e620df4c43
48
faults.go
Normal file
48
faults.go
Normal file
@ -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{}
|
@ -50,6 +50,7 @@ type SectorManager interface {
|
|||||||
|
|
||||||
ffiwrapper.StorageSealer
|
ffiwrapper.StorageSealer
|
||||||
storage.Prover
|
storage.Prover
|
||||||
|
FaultTracker
|
||||||
}
|
}
|
||||||
|
|
||||||
type WorkerID uint64
|
type WorkerID uint64
|
||||||
|
@ -288,6 +288,10 @@ func (mgr *SectorMgr) FinalizeSector(context.Context, abi.SectorID) error {
|
|||||||
return nil
|
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) {
|
func (m mockVerif) VerifySeal(svi abi.SealVerifyInfo) (bool, error) {
|
||||||
if len(svi.OnChain.Proof) != 32 { // Real ones are longer, but this should be fine
|
if len(svi.OnChain.Proof) != 32 { // Real ones are longer, but this should be fine
|
||||||
return false, nil
|
return false, nil
|
||||||
|
@ -201,16 +201,16 @@ var ResourceTable = map[sealtasks.TaskType]map[abi.RegisteredProof]Resources{
|
|||||||
Threads: -1,
|
Threads: -1,
|
||||||
CanGPU: true,
|
CanGPU: true,
|
||||||
|
|
||||||
BaseMinMemory: 128 << 30, // params
|
BaseMinMemory: 64 << 30, // params
|
||||||
},
|
},
|
||||||
abi.RegisteredProof_StackedDRG32GiBSeal: Resources{
|
abi.RegisteredProof_StackedDRG32GiBSeal: Resources{
|
||||||
MaxMemory: 130 << 30,
|
MaxMemory: 150 << 30, // TODO: ~30G of this should really be BaseMaxMemory
|
||||||
MinMemory: 30 << 30,
|
MinMemory: 30 << 30,
|
||||||
|
|
||||||
Threads: -1,
|
Threads: -1,
|
||||||
CanGPU: true,
|
CanGPU: true,
|
||||||
|
|
||||||
BaseMinMemory: 64 << 30, // params
|
BaseMinMemory: 32 << 30, // params
|
||||||
},
|
},
|
||||||
abi.RegisteredProof_StackedDRG512MiBSeal: Resources{
|
abi.RegisteredProof_StackedDRG512MiBSeal: Resources{
|
||||||
MaxMemory: 3 << 29, // 1.5G
|
MaxMemory: 3 << 29, // 1.5G
|
||||||
|
Loading…
Reference in New Issue
Block a user