Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuse v2 #4772

Merged
merged 70 commits into from May 24, 2020
Merged

Fuse v2 #4772

merged 70 commits into from May 24, 2020

Conversation

jdoliner
Copy link
Member

@jdoliner jdoliner commented Apr 7, 2020

This PR does two things:

  • It upgrades us to the newest version of the fuse library we've been using, which fixes Pachctl mount doesn't work on GKE. #4558 among some other benefits.
  • It also adds support for writes to fuse volumes which will get committed back into Pachyderm when you unmount.

This also meaningfully changes the architecture of the fuse client. It's now implemented as a loopback filesystem, which the fuse library already had a built in implementation of that used as the starting point. This saves us from having to actually implement the full POSIX filesystem API, since we can just proxy calls to the underlying filesystem. The only thing that needed to be added was code to materialize the filesystem as the user requests pieces of it. So while this is more code than the system it's replacing, it's simpler because most of the code is just proxying various requests to and from the filesystem.

TODO:

  • handle writes to multiple directories
  • delete files on unmount
  • consider on-disk caching to speed up remounts

@netlify
Copy link

netlify bot commented Apr 7, 2020

Your website preview is ready! Hooray! 🎉

Built with commit eecef1f

https://deploy-preview-4772--pachyderm-docs.netlify.app

src/client/pfs.go Show resolved Hide resolved
if len(msgArgs) > 0 {
err, ok := msgArgs[0].(error)
if ok {
var st go_errors.StackTrace
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't need to do this, our errors package should just re-export this like it does everything else.

err, ok := msgArgs[0].(error)
if ok {
var st go_errors.StackTrace
for err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be a good util to put in the errors package as an exported function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, it's copy pasted twice in this review so should be a util.

}
}
if flag != "" {
if flag == "w" || flag == "rw" {
Copy link
Contributor

Choose a reason for hiding this comment

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

This assumes that 'r' will always precede 'w' - chmod doesn't seem to require this. I think you should just check for the presence of each character and error on unrecognized chars.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, will do.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed, the only thing weird about it is that people can pass letters multiple times, i.e. "rwwrwrw" is the same as "rw" I didn't really see any reason to prevent that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, chmod allows that as well, so I think it's fine to copy their semantics.

src/server/pfs/server/api_server.go Outdated Show resolved Hide resolved
src/server/pfs/server/driver.go Outdated Show resolved Hide resolved
var oneOff bool
var repo string
var branch string

var pr *io.PipeReader
var pw *io.PipeWriter
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it just me or are there a lot of places in this function that don't close pw? Not really related to this change, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

The code here is kinda convoluted, but I think each io.Pipe() call has a matching pw.Close() call. There's two close sites, one that happens before we assign a new value to pw and one that happens at the end no matter what. That one is actually a little confusing, because it actually calls pw.CloseWithError(err), which makes it look like it's handling an error, rather than normal execution, but under normal execution err will be equal to io.EOF and pw.Close() is actually just implemented as pw.CloseWithError(io.EOF) so I simplified it a bit.

src/server/pfs/server/driver.go Outdated Show resolved Hide resolved
}
server, err := fs.Mount(target, root, opts.getFuse())
if err != nil {
return errors.Wrap(err, "fs.Mount")
Copy link
Contributor

Choose a reason for hiding this comment

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

For places like this (where the stack makes it clear where the error came from, and the wrap isn't adding any new information), I added an errors.WithStack to use instead of errors.Wrap. Also, this should be used for any errors from non-pachyderm code, like the ioutil.TempDir and os.RemoveAll above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, will do.

src/server/pfs/fuse/options.go Outdated Show resolved Hide resolved
@jdoliner
Copy link
Member Author

Alright, I think I addressed everything here. Ready for another pass, make sure to take a look at the error stack traversing / printing code. I factored that into an exported function, which I think covers everything you were asking for but I'm not 100% sure I understood what you were asking for.

Copy link
Contributor

@Tryneus Tryneus left a comment

Choose a reason for hiding this comment

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

LGTM

commits[repo] = branch
}
}
// branches := opts.getBranches()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: commented code

Copy link
Contributor

@actgardner actgardner left a comment

Choose a reason for hiding this comment

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

LGTM

@jdoliner jdoliner merged commit 45c995a into master May 24, 2020
1.11 automation moved this from In Review to Complete May 24, 2020
@echohack echohack deleted the fuse_v2 branch March 18, 2021 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
1.11
  
Complete
Development

Successfully merging this pull request may close these issues.

Pachctl mount doesn't work on GKE.
4 participants