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

On a file stat operation, return the largest byte that has been written #2078

Open
2 tasks
JustinKyleJames opened this issue Jul 27, 2022 · 1 comment
Open
2 tasks
Assignees
Labels

Comments

@JustinKyleJames
Copy link
Contributor

JustinKyleJames commented Jul 27, 2022

  • master
  • 4-2-stable

POSIX allows for a stat to be executed before a close has been called. The stat will return the file size up to that point.

In the S3 plugin, the stat translates to a HEAD request. However, the S3 object does not yet exist if the stat is done before the close.

To handle the itouch scenario (see irods/irods#6880), we return the file size of 0 if stat follows a create prior to a close. However, this does not cover a scenario like the following: create, write, stat, close.

To make it more POSIX-like, keep track of the maximum byte written and return this if a stat is called before a close. If the stat is called after a close, do a HEAD as normal.

This was found while testing istream which, unlike iput, does a stat before the final close.

@trel trel added the bug label Jul 27, 2022
@JustinKyleJames
Copy link
Contributor Author

JustinKyleJames commented Jul 29, 2022

This has been changed slightly to handle istream --append.

On the stat, if the close operation has not been executed, look for a local cache file. (There should always be one if --append is used.) If it exists, do a stat() of it to get the object size.

If the cache file does not exist, then return maximum byte written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants