Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Conversation

@magik6k
Copy link
Collaborator

@magik6k magik6k commented Feb 27, 2020

This PR aims to move a bunch of filesystem/worker handling logic up to implementations, making the codebase here much, much smaller and cleaner, and giving impls better flexibility

Also exposes the new 4-stage sector sealing process

@magik6k magik6k force-pushed the feat/redo-interfaces branch from fe0c7e2 to 73445bc Compare February 28, 2020 06:44
@magik6k magik6k marked this pull request as ready for review February 28, 2020 17:09
@magik6k magik6k force-pushed the feat/redo-interfaces branch from be23337 to 442fe78 Compare February 29, 2020 02:22
@magik6k
Copy link
Collaborator Author

magik6k commented Feb 29, 2020

(Currently based on #81 to have it work in lotus)

@magik6k magik6k changed the title WIP More flexible interfaces More flexible interfaces Feb 29, 2020
@magik6k magik6k requested review from icorderi and laser March 6, 2020 04:47
Copy link
Contributor

@laser laser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big changes here - and I'm glad to see that the operational stuff (e.g. worker-related code) is gone.

Two main observations:

  • I'm not sure why the SectorProvider interface exists when we could simply implement storage.Storage. That cutover would require that the caller give up control of the picking of the sector number (because storage.Storage#NewSector picks it for them), but that doesn't seem like a big deal to me.
  • The AcquireSector method returns a function which I believe is used to coordinate concurrent access to sector files - but the one implementation of SectorProvider#AcquireSector (Basic) in this PR returns a no-op function, which leads me to believe that SectorBuilder#ReadPieceFromSealedSector is racey.


// TODO: this needs to get smarter when we start supporting partial unseals
unsealedPath, err := sfs.AllocSector(fs.DataUnsealed, sb.Miner, sb.ssize, true, sectorNum)
path, doneUnsealed, err := sb.sectors.AcquireSector(ctx, sectorNum, FTUnsealed, FTUnsealed, false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want to pass sectorNum to AcquireSector here (for the temporary file used to hold unsealed bytes).

Imagine a scenario in which SectorBuilder#ReadPieceFromSealedSector is called concurrently for the same sectorNum. The two calls will race: Both will call ffi.Unseal and will provide the same destination file path, and likely clobber each other's file writes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The above comment assumes that sb.sectors is of type Basic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants