Repository navigation
Conversation
… copy If doing a copy from a remote to local with multiple streams and --size-only (either explicit or implied by the remote, e.g., WebDAV), it is conceivable for an interrupted transfer to not get restarted since it's "size" is correct even if the content is not. This was fixed by withholding the very last byte until the rest of the transfer is complete. This way, the size of the file always mismatches until completed Fixes rclone#6206
|
Is there an update on this? Plan to merge? |
ncw
left a comment
There was a problem hiding this comment.
I think this is a great idea.
The implementation could be made more efficient though - please see inline.
| return nil, err | ||
| } | ||
|
|
||
| // Copy last withheld byte |
There was a problem hiding this comment.
This Open will cause another HTTP transaction to the backend and hence quite a lot of extra work / delay for each file.
Ideally what we'd do is fetch the last byte above where we have the connection open, stash it away, and store it here.
|
I mentioned in the original forum post that an alternative would be to preallocate an extra byte and truncate. Since this is only for local destination, can all local remotes support truncate? That would solve the book-keeping and be simple. |
|
Yes that seems like a good idea. You should be able to truncate the file with OpenWriterAt by opening it again I think. We could always add truncate to that interface if necessary. |
|
I'd like to get the efficiency thing resolved, either by keeping the last byte, or using the preallocate trick. @Evan-sp do you want to have a go at this? If not how about you @Jwink3101 ? |
|
In 5c594fe we implemented transfers to a temporary file name on the local, ftp and sftp backends unless the I think this therefore fixes the issue that this PR is intended to fix as the file won't be renamed to its proper name unless the download completes properly. I'm therefore going to close this PR. Thank you @Evan-sp for doing it and sorry we didn't get it merged. |
… copy
What is the purpose of this change?
Fix #6206 by withholding the very last byte until the rest of the transfer is complete
Was the change discussed in an issue or in the forum before?
#6206
Checklist