Review fixes

This commit is contained in:
Geoff Stuart 2022-04-22 14:29:35 +02:00
parent 98637b357b
commit 2134f165c0
2 changed files with 11 additions and 7 deletions

View File

@ -380,11 +380,11 @@ func (sb *Sealer) tryDecodeUpdatedReplica(ctx context.Context, sector storage.Se
}
defer done()
sealedPaths, releaseSectorKey, err := sb.AcquireSectorKeyOrRegenerate(ctx, sector, randomness)
sealedPaths, done2, err := sb.AcquireSectorKeyOrRegenerate(ctx, sector, randomness)
if err != nil {
return false, xerrors.Errorf("acquiring sealed sector: %w", err)
}
defer releaseSectorKey()
defer done2()
// Sector data stored in replica update
updateProof, err := sector.ProofType.RegisteredUpdateProof()

View File

@ -282,11 +282,15 @@ func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storage.SectorR
sealFetch := func(ctx context.Context, worker Worker) error {
log.Debugf("copy sealed/cache sector data for sector %d", sector.ID)
_, err := m.waitSimpleCall(ctx)(worker.Fetch(ctx, sector, storiface.FTSealed|storiface.FTCache, storiface.PathSealing, storiface.AcquireCopy))
if err != nil {
_, err2 := m.waitSimpleCall(ctx)(worker.Fetch(ctx, sector, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing, storiface.AcquireCopy))
if err2 != nil {
return xerrors.Errorf("copy sealed/cache sector data: %w %w", err, err2)
if err != nil && !xerrors.Is(err, storiface.ErrSectorNotFound) {
return err
}
_, err2 := m.waitSimpleCall(ctx)(worker.Fetch(ctx, sector, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing, storiface.AcquireCopy))
if err2 != nil && !xerrors.Is(err, storiface.ErrSectorNotFound) {
return err
}
if err != nil && err2 != nil {
return xerrors.Errorf("cannot unseal piece. No sealed or updated sector found")
}
return nil