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

Upload 0 byte files on file closure #1226

Open
muddyfish opened this issue Jan 13, 2025 · 0 comments
Open

Upload 0 byte files on file closure #1226

muddyfish opened this issue Jan 13, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@muddyfish
Copy link
Contributor

Tell us more about this new feature.

When a file is closed with 0 bytes written, Mountpoint currently waits until all references are removed before committing to S3. This is a sharp edge customers have faced in case they actually want to write an empty file to S3.

On a filesystem level, Mountpoint only knows about file handles, but on the user side, there are file descriptors. The user can duplicate file descriptors pointing to the same file handle. When the customer closes a file handle, MP receives a flush call. When the last file descriptor is closed, MP receives a release. Mountpoint needs to decide when to do a MPU complete, and currently we try to do this on flush. Mountpoint generally doesn't allow further writes after a flush except if the current size is 0 bytes to support cases such as touch, and shell redirects.

This is a deliberate special case to our semantics for these common cases (touch & shell redirects).

We're proposing modifying this behavior by writing to S3 when the file size is 0, by double-committing and actually writing 0 bytes to S3. If we later get more data, we can start a new upload as semantically replacing is the same as appending to a zero byte file.

We should consider the usage of If-Match headers to verify the file hasn't been changed between the two commits.

@muddyfish muddyfish added the enhancement New feature or request label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant