Request correct read size with startOffset in pieceProvider
This commit is contained in:
parent
9110e6f632
commit
05aa860459
2
extern/sector-storage/piece_provider.go
vendored
2
extern/sector-storage/piece_provider.go
vendored
@ -82,7 +82,7 @@ func (p *pieceProvider) tryReadUnsealedPiece(ctx context.Context, sector storage
|
||||
// Reader returns a reader for an unsealed piece at the given offset in the given sector.
|
||||
// The returned reader will be nil if none of the workers has an unsealed sector file containing
|
||||
// the unsealed piece.
|
||||
r, err := p.storage.Reader(ctx, sector, abi.PaddedPieceSize(pieceOffset.Padded()+startOffset.Padded()), size.Padded())
|
||||
r, err := p.storage.Reader(ctx, sector, abi.PaddedPieceSize(pieceOffset.Padded()+startOffset.Padded()), size.Padded()-abi.PaddedPieceSize(startOffset.Padded()))
|
||||
if err != nil {
|
||||
log.Debugf("did not get storage reader;sector=%+v, err:%s", sector.ID, err)
|
||||
cancel()
|
||||
|
@ -110,7 +110,7 @@ func (p *pieceReader) ReadAt(b []byte, off int64) (n int, err error) {
|
||||
p.r = nil
|
||||
}
|
||||
|
||||
log.Debugw("pieceReader new stream", "at", p.rAt, "off", off-p.rAt)
|
||||
log.Debugw("pieceReader new stream", "piece", p.pieceCid, "at", p.rAt, "off", off-p.rAt)
|
||||
|
||||
p.rAt = off
|
||||
p.r, _, err = p.api.FetchUnsealedPiece(p.ctx, p.pieceCid, uint64(p.rAt))
|
||||
|
Loading…
Reference in New Issue
Block a user