Merge pull request #5851 from filecoin-project/fix/rtrvl-log
better logging when unsealing fails
This commit is contained in:
commit
897c5c7d82
@ -4,6 +4,9 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -16,10 +19,10 @@ import (
|
||||
"github.com/filecoin-project/go-fil-markets/shared"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
specstorage "github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
)
|
||||
|
||||
var log = logging.Logger("retrievaladapter")
|
||||
|
||||
type retrievalProviderNode struct {
|
||||
miner *storage.Miner
|
||||
sealer sectorstorage.SectorManager
|
||||
@ -61,13 +64,20 @@ func (rpn *retrievalProviderNode) UnsealSector(ctx context.Context, sectorID abi
|
||||
ProofType: si.SectorType,
|
||||
}
|
||||
|
||||
// Set up a pipe so that data can be written from the unsealing process
|
||||
// into the reader returned by this function
|
||||
r, w := io.Pipe()
|
||||
go func() {
|
||||
var commD cid.Cid
|
||||
if si.CommD != nil {
|
||||
commD = *si.CommD
|
||||
}
|
||||
// Read the piece into the pipe's writer, unsealing the piece if necessary
|
||||
err := rpn.sealer.ReadPiece(ctx, w, ref, storiface.UnpaddedByteIndex(offset), length, si.TicketValue, commD)
|
||||
if err != nil {
|
||||
log.Errorf("failed to unseal piece from sector %d: %s", sectorID, err)
|
||||
}
|
||||
// Close the reader with any error that was returned while reading the piece
|
||||
_ = w.CloseWithError(err)
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user