Skip to content

Commit

Permalink
curio: make ensureOneCopy safer
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Apr 7, 2024
1 parent 80dec0b commit 9a8785c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions curiosrc/ffi/sdr_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ func (sb *SealCalls) GenerateSDR(ctx context.Context, taskID harmonytask.TaskID,
// ensureOneCopy makes sure that there is only one version of sector data.
// Usually called after a successful operation was done successfully on sector data.
func (sb *SealCalls) ensureOneCopy(ctx context.Context, sid abi.SectorID, pathIDs storiface.SectorPaths, fts storiface.SectorFileType) error {
if !pathIDs.HasAllSet(fts) {
return xerrors.Errorf("ensure one copy: not all paths are set")

}
for _, fileType := range fts.AllSet() {

pid := storiface.PathByType(pathIDs, fileType)

keepIn := []storiface.ID{storiface.ID(pid)}
Expand Down
2 changes: 1 addition & 1 deletion storage/paths/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ func (st *Local) removeSector(ctx context.Context, sid abi.SectorID, typ storifa
}

spath := p.sectorPath(sid, typ)
log.Infof("remove %s", spath)
log.Infow("remove", "path", spath, "id", sid, "type", typ, "storage", storage)

if err := os.RemoveAll(spath); err != nil {
log.Errorf("removing sector (%v) from %s: %+v", sid, spath, err)
Expand Down

0 comments on commit 9a8785c

Please sign in to comment.