diff --git a/localworker.go b/localworker.go index 694e87276..31d357bb0 100644 --- a/localworker.go +++ b/localworker.go @@ -193,7 +193,11 @@ func (l *LocalWorker) UnsealPiece(ctx context.Context, sector abi.SectorID, inde return xerrors.Errorf("unsealing sector: %w", err) } - if err := l.storage.RemoveCopies(ctx, sector, stores.FTSealed|stores.FTCache); err != nil { + if err := l.storage.RemoveCopies(ctx, sector, stores.FTSealed); err != nil { + return xerrors.Errorf("removing source data: %w", err) + } + + if err := l.storage.RemoveCopies(ctx, sector, stores.FTCache); err != nil { return xerrors.Errorf("removing source data: %w", err) } diff --git a/manager.go b/manager.go index daa522c92..07484e041 100644 --- a/manager.go +++ b/manager.go @@ -213,8 +213,10 @@ func (m *Manager) ReadPiece(ctx context.Context, sink io.Writer, sector abi.Sect return xerrors.Errorf("copy sealed/cache sector data: %w", err) } - if err := worker.Fetch(ctx, sector, stores.FTUnsealed, true, stores.AcquireMove); err != nil { - return xerrors.Errorf("copy unsealed sector data: %w", err) + if len(best) > 0 { + if err := worker.Fetch(ctx, sector, stores.FTUnsealed, true, stores.AcquireMove); err != nil { + return xerrors.Errorf("copy unsealed sector data: %w", err) + } } return nil }