You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we're in a cross-storage situation, the rename/move operation will internally do a stream copy of "/huge.dat" into "/smb/huge.dat".
This means that for a short time we have a partial file on the target storage which might be picked up by a running scanner or other people.
One idea would be to first copy the file from "/huge.dat" to "/smb/huge.dat.transactionId.part". Then if the copy succeeded, rename the part file to the final file, just like it's done for regular uploads.
But in this case it's an "internal upload" between storages.
I noticed this while investigating the "preserve file id cross storage" case.
Currently the target file isn't finished, but there is already a cache entry for it with zero size. I'd expect the cache entry to only appear once the transfer is completely finished. (and if you run ./occ files:scan during the transfer, that cache entry will have the partial size of the file)
We already have these checks during WebDAV upload (expected size, etc) and rename after a full upload, and only if the file is completely uploaded. Why not reuse the same logic for cross storage copy/upload to add the same kind of robustness ?
We could move that logic into a generic class or storage handler (a bit like the chunk handler but for part files) and have the verification code there.
High level locks might help for storages that OC control.
But if the storage is external and used outside of OC (ex: SMB), part files can help to not overwrite the final file too early as we do now.
High level locks might help for storages that OC control.
But if the storage is external and used outside of OC (ex: SMB), part files can help to not overwrite the final file too early as we do now.
indeed - I was more thinking about the getting-ignored-by-scanner requirement. Overwrite is to be handled by part files - true.
Upload a small file (8kb) into "/sftp/data1.dat" (overwrite)
Even though the file is very small, it takes a long time to upload because in the background the trashbin is downloading the huge file to trash before replacing it.
Here we could first rename the old "data1.dat" to "data1.dat.todelete.part", put the new file and then download the part file to trash. Maybe the download could be done in a bkg job instead.
Activity
PVince81 commentedon Jan 21, 2015
We already have these checks during WebDAV upload (expected size, etc) and rename after a full upload, and only if the file is completely uploaded. Why not reuse the same logic for cross storage copy/upload to add the same kind of robustness ?
We could move that logic into a generic class or storage handler (a bit like the chunk handler but for part files) and have the verification code there.
DeepDiver1975 commentedon Jan 21, 2015
Sounds reasonable to me - looks like part files will become more and more important - some days back we had the idea to fully remove them.
What comes to my mind here are higher-level-transactions/locks - this might me a solution as well.
PVince81 commentedon Jan 21, 2015
High level locks might help for storages that OC control.
But if the storage is external and used outside of OC (ex: SMB), part files can help to not overwrite the final file too early as we do now.
DeepDiver1975 commentedon Jan 21, 2015
indeed - I was more thinking about the getting-ignored-by-scanner requirement. Overwrite is to be handled by part files - true.
PVince81 commentedon Jun 24, 2015
Another test case I observed:
Even though the file is very small, it takes a long time to upload because in the background the trashbin is downloading the huge file to trash before replacing it.
Here we could first rename the old "data1.dat" to "data1.dat.todelete.part", put the new file and then download the part file to trash. Maybe the download could be done in a bkg job instead.