Merge pull request #9614 from filecoin-project/asr/move-unsealed

refactor: sealing: minor refactor of FinalizeReplicaUpdate
This commit is contained in:
Łukasz Magiera 2022-11-11 13:10:02 +01:00 committed by GitHub
commit 6104567fb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -740,11 +740,6 @@ func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storiface.Se
move := func(types storiface.SectorFileType) error { move := func(types storiface.SectorFileType) error {
// get a selector for moving stuff into long-term storage // get a selector for moving stuff into long-term storage
fetchSel := newMoveSelector(m.index, sector.ID, types, storiface.PathStorage, !m.disallowRemoteFinalize) fetchSel := newMoveSelector(m.index, sector.ID, types, storiface.PathStorage, !m.disallowRemoteFinalize)
{
if len(keepUnsealed) == 0 {
moveUnsealed = storiface.FTNone
}
}
err = m.sched.Schedule(ctx, sector, sealtasks.TTFetch, fetchSel, err = m.sched.Schedule(ctx, sector, sealtasks.TTFetch, fetchSel,
m.schedFetch(sector, types, storiface.PathStorage, storiface.AcquireMove), m.schedFetch(sector, types, storiface.PathStorage, storiface.AcquireMove),
@ -760,7 +755,8 @@ func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storiface.Se
err = multierr.Append(move(storiface.FTUpdate|storiface.FTUpdateCache), move(storiface.FTCache)) err = multierr.Append(move(storiface.FTUpdate|storiface.FTUpdateCache), move(storiface.FTCache))
err = multierr.Append(err, move(storiface.FTSealed)) // Sealed separate from cache just in case ReleaseSectorKey was already called err = multierr.Append(err, move(storiface.FTSealed)) // Sealed separate from cache just in case ReleaseSectorKey was already called
if moveUnsealed != storiface.FTNone { // if we found unsealed files, AND have been asked to keep at least one, move unsealed
if moveUnsealed != storiface.FTNone && len(keepUnsealed) != 0 {
err = multierr.Append(err, move(moveUnsealed)) err = multierr.Append(err, move(moveUnsealed))
} }