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
mv slow, always uses copyFile, even if fs.rename is possible #158
Comments
Hi @anneb , from the best of my knowledge that was changed from move to copy because mv method doesn't work if you try to mv file between different partitions. Does your change work for such cases? |
Indeed, the standard rename method does not work across partitions. For this reason, the code in the pull request first tries a rename and resorts to 'copy' if the rename should fail. If this code is applied, It is advisable (not required) to store temp files on the same partition as uploaded files to improve performance. |
One thing I'm not sure that rename throws an error in case of different partitions. Do you now something about that? |
According to documentation, fs.rename throws error code 'EXDEV' if it cannot rename across devices. In this commit: a4f13ff, I see that fs.rename gets replaced by copyFile to solve the 'mv across filesystems' problem. The problem of not throwing an error is not mentioned. I just tested with both Ubuntu and Windows:
In both cases, fs.rename throws an error with code 'EXDEV' and the code from the pull request then calls the original copyFile code:
|
Hi @anneb , Thanks for checking that! |
After uploading a large file (using tempfiles), the mv function may take quite some time, because the tempfile is being copied instead of being renamed. This takes more time and requires more available disk space.
Pull request #157 tries to rename the file and resort to copyFile only if the rename should fail.
The text was updated successfully, but these errors were encountered: