Merge pull request #10121 from filecoin-project/feat/better-post-errors

feat: wdpost: Emit more detailed errors
This commit is contained in:
Geoff Stuart 2023-01-26 09:36:11 -05:00 committed by GitHub
commit 5740f17037
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"sort" "sort"
"sync" "sync"
"time"
"go.uber.org/multierr" "go.uber.org/multierr"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -82,7 +83,12 @@ func (m *Manager) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, s
// if builtin PoSt isn't disabled, and there are no workers, compute the PoSt locally // if builtin PoSt isn't disabled, and there are no workers, compute the PoSt locally
log.Info("GenerateWindowPoSt run at lotus-miner") log.Info("GenerateWindowPoSt run at lotus-miner")
return m.localProver.GenerateWindowPoSt(ctx, minerID, sectorInfo, randomness) p, s, err := m.localProver.GenerateWindowPoSt(ctx, minerID, sectorInfo, randomness)
if err != nil {
return nil, nil, xerrors.Errorf("local prover: %w", err)
}
return p, s, nil
} }
return m.generateWindowPoSt(ctx, minerID, sectorInfo, randomness) return m.generateWindowPoSt(ctx, minerID, sectorInfo, randomness)
@ -217,18 +223,20 @@ func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, s
func (m *Manager) generatePartitionWindowPost(ctx context.Context, spt abi.RegisteredSealProof, ppt abi.RegisteredPoStProof, minerID abi.ActorID, partIndex int, sc []storiface.PostSectorChallenge, randomness abi.PoStRandomness) (proof.PoStProof, []abi.SectorID, error) { func (m *Manager) generatePartitionWindowPost(ctx context.Context, spt abi.RegisteredSealProof, ppt abi.RegisteredPoStProof, minerID abi.ActorID, partIndex int, sc []storiface.PostSectorChallenge, randomness abi.PoStRandomness) (proof.PoStProof, []abi.SectorID, error) {
log.Infow("generateWindowPost", "index", partIndex) log.Infow("generateWindowPost", "index", partIndex)
start := time.Now()
var result storiface.WindowPoStResult var result storiface.WindowPoStResult
err := m.windowPoStSched.Schedule(ctx, true, spt, func(ctx context.Context, w Worker) error { err := m.windowPoStSched.Schedule(ctx, true, spt, func(ctx context.Context, w Worker) error {
out, err := w.GenerateWindowPoSt(ctx, ppt, minerID, sc, partIndex, randomness) out, err := w.GenerateWindowPoSt(ctx, ppt, minerID, sc, partIndex, randomness)
if err != nil { if err != nil {
return err return xerrors.Errorf("post worker: %w", err)
} }
result = out result = out
return nil return nil
}) })
log.Warnf("generateWindowPost partition:%d, get skip count:%d", partIndex, len(result.Skipped)) log.Warnw("generateWindowPost done", "index", partIndex, "skipped", len(result.Skipped), "took", time.Since(start).String(), "err", err)
return result.PoStProofs, result.Skipped, err return result.PoStProofs, result.Skipped, err
} }

View File

@ -706,11 +706,15 @@ func (l *LocalWorker) GenerateWindowPoSt(ctx context.Context, ppt abi.Registered
} }
res, err := sb.GenerateWindowPoStWithVanilla(ctx, ppt, mid, randomness, vproofs, partitionIdx) res, err := sb.GenerateWindowPoStWithVanilla(ctx, ppt, mid, randomness, vproofs, partitionIdx)
r := storiface.WindowPoStResult{
return storiface.WindowPoStResult{
PoStProofs: res, PoStProofs: res,
Skipped: skipped, Skipped: skipped,
}, err }
if err != nil {
log.Errorw("generating window PoSt failed", "error", err)
return r, xerrors.Errorf("generate window PoSt with vanilla proofs: %w", err)
}
return r, nil
} }
func (l *LocalWorker) TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error) { func (l *LocalWorker) TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error) {