Skip to content

Conversation

@mcalman
Copy link

@mcalman mcalman commented Sep 1, 2020

Added an interface for resuming failed uploads. Later on this interface
can be implemented by any backend where resumes are possible.

#87

What is the purpose of this change?

Adds an optional interface for resuming uploads that can later be implemented by any backend where resuming uploads is possible. Once implemented by a backend, this will allow uploads to continue after a failure, even when restarting Rclone operations.

Was the change discussed in an issue or in the forum before?

#87
https://forum.rclone.org/t/drive-resume-resumable-upload-implementation/18289/4
https://forum.rclone.org/t/chunker-resume-upload-contribution/18571

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@ncw
Copy link
Member

ncw commented Sep 2, 2020

This looks very nice :-)

I'm just in the middle of making the 1.53 release - I will review in detail after that is done.

Copy link
Member

@ncw ncw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v1.53 is out the door! Apologies for the delay in reviewing.

I think this is a good start - thank you :-)

I wrote lots of comments inline.

Can you factor the ~100 extra lines in operations.Copy so we try to keep things readable.

We'll need to write tests too, so having functions we can test individually will be very useful :-)

@ivandeex

This comment has been minimized.

@ivandeex

This comment has been minimized.

@ivandeex

This comment has been minimized.

@ivandeex ivandeex marked this pull request as draft February 17, 2021 01:39
@mcalman
Copy link
Author

mcalman commented Feb 25, 2021

@ivandeex @ncw All inline comments have been addressed except for this one which I'd like to hear your feedback on. #4547 (comment)

@ivandeex ivandeex marked this pull request as ready for review February 25, 2021 20:02
@ivandeex ivandeex requested a review from ncw February 25, 2021 20:04
@ivandeex ivandeex self-requested a review February 26, 2021 08:51
@ivandeex

This comment has been minimized.

@ivandeex

This comment has been minimized.

@ivandeex

This comment has been minimized.

@ivandeex
Copy link
Member

ivandeex commented Feb 26, 2021

Specific questions about the upload cache:

  • Who decides to copy source to upload cache or use source directly, backend or generic code in operations.go?
  • If a source is "stable", can we avoid copying to cache and keep only json?
  • If a source is "dynamic", can we force copying to cache?

UPDATE 2021-03-17
https://forum.rclone.org/t/http-upload-contribution/13271/39

I think for the first version you want to cache the upload in the upload handler. However that doesn't require writing it to disk if all the writing is being done sequentially, it can be written straight to the backend. What will need to be cached for the upload handler is the handle used for writing data to the backend.

@ivandeex
Copy link
Member

ivandeex commented Feb 26, 2021

As to why I care about resumable accrued (rolling) checksums (if supported by a backend),
please consider this scenario:

  • user uploads a large file
  • network broken, upload canceled
  • source file is changed or another attempt is changing the partial upload on target
  • user asks to resume a file
  • rclone resumes (here we could have checked validity of partial upload and rewind from start)
  • after some hours rclone finds that fingerprint is wrong
  • abort, retry

EDIT if backend does not support it, its interface will return a nil accrued hashsum.

@ivandeex

This comment has been minimized.

@ivandeex ivandeex modified the milestones: v1.57, v1.58 Oct 18, 2021
@ivandeex ivandeex mentioned this pull request Oct 18, 2021
@mcalman mcalman force-pushed the add-resume-interface branch from d14ff61 to bcc590a Compare October 19, 2021 22:04
@ivandeex
Copy link
Member

ivandeex commented Nov 1, 2021

@ncw
Can we have this merged to start beta testing and have more time before 1.58 to settle with Tus refactor and finish glitches?

@mcalman
Could you please resolve yet again the permanent merge conflict about global flags? :)
Feel free to drop my "local/resume" patch. If/when we have this on master branch, I will resubmit it in another PR...

@innovate-invent
Copy link
Contributor

My objections to this PR seem to have been collapsed under loads of commit messages.
@ncw please take them into consideration before merging
#4547 (comment)

@ivandeex
Copy link
Member

This "loads of commits and messages" is called working on your PR.

@ivandeex ivandeex modified the milestones: v1.58, v1.59 Nov 17, 2021
@ivandeex ivandeex force-pushed the add-resume-interface branch from bcc590a to 667fb97 Compare November 17, 2021 17:21
ivandeex and others added 4 commits November 17, 2021 20:32
Added an interface and machinery for resuming failed uploads.
Implemented this interface in the local backend.
Later on it can be implemented by any supporting backend.

Fixes rclone#87
- report errors if any
- prevent double invocation
- prefer saved hash type when many are supported
@ivandeex ivandeex force-pushed the add-resume-interface branch from 667fb97 to 604dc4d Compare November 17, 2021 17:33
@ivandeex
Copy link
Member

ivandeex commented Nov 17, 2021

@mcalman

This PR is waiting for @ncw to review

which is a spin off from

which is stuck forever.

Unfortunately #5299 is pretty far from production and altogether invasive on core parts of rclone.
Reviewing it by reading the code is not simple and not enough as it like this PR changes code in the rclone core.
The process will definitely include writing tests and ensuring that current functionality does not get broken.

As far as I can see @ncw actively discussed early design of that PR.
Currently waiting for @ncw to find time for review.
If it's not done by next January, I am going to untangle the knot myself.
Probably I will combine code from both proposals, add appropriate tests and submit as new patch.

In the meantime I have added the patch from

on top of this one - at any rate I will consider all parts together.

I do not expect the solution to come before the 1.58 release so I expect the resume feature to appear in 1.59.

@innovate-invent This patch will not be merged on rclone master branch before that, which is at least 3 months from now.

However, the patch of this PR has already solved me hours of work time by resuming downloads ("uploads" onto local backend) failed due to network hiccups.
In the meantime I created a beta branch and a beta release to use this code in practice.
The beta releases will be available at https://beta.rclone.org/branch/resume/

@mcalman By the way, you can open pull requests against the beta branch https://github.com/rclone/rclone/commits/resume

cc @ncw

@ivandeex
Copy link
Member

@mcalman I am sorry about the situation

@ivandeex
Copy link
Member

The PR branch as well as https://beta.rclone.org/branch/resume/ is rebased on the current master.

@ivandeex ivandeex removed the request for review from ncw November 19, 2021 17:36
@maxcalman
Copy link

If it's not done by next January, I am going to untangle the knot myself.

@ivandeex Was just wondering what your status is. Do you still think it is likely the resume feature will be included in 1.59?

@ivandeex
Copy link
Member

ivandeex commented Mar 12, 2022

I'm hit heavily by anti-Rus sanctions, plans broken. Most of the short-term time I'll be recovering whatever I can w.r.t. migrating work env, accounts and payments etc. Can't promise anything concrete a.t.m.

@ncw ncw modified the milestones: v1.59, v1.60 Jul 9, 2022
@ncw ncw removed this from the v1.60 milestone Dec 5, 2022
@flopraden
Copy link

Hello,
Using resume and bandwidth limiting is not really working as expected (?).
The bandwith limit feature will limit the resume speed... So for now, I'm testing using remote controll to enable bandwith limit at the end of the resume.

@God-damnit-all
Copy link

The rclone beta that includes the resumer interface posted at https://beta.rclone.org/branch/resume/ is quite out of date now, only at 1.58 while stable is at 1.62.2 with 1.63 just over the horizon. Any chance of getting the resume branch back in line with the master branch?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resume uploads

7 participants