Skip to content

Allow remote-delta on sync files #16162

Closed

Description

@gadLinux

Hi,
I want to fix this improvement ASAP.
owncloud/client#179

It relates to the remote-delta implementation on client. But I suppose it must be supported on both sides. I saw that latest version of csync inludes a module for owncloud but it differs on current implementation of client on github.

in fact I saw that's using a special module that's not on the normal csync library that's called httpbf. It seems for me that's sending the whole file as PUT http?

So my question is. If you will want to implement rsync how will you implement it?

I was thinking about clone a module on csync and make it transfer using remote-delta (surely using rsync lib) instead of sending the whole file in chunks.

What do you think? Any suggestions?

Using httpbf. I can detect what's changed and send only the blocks that are changed. But this would mean extra work for nothing. Because librsync already implements this kind of processing we are not going to do ti twice.

Best regards,

Activity

  1. jospoortvliet commented on May 22, 2015

    @jospoortvliet

    @danimo @dragotin @ogoffart @guruz could you guys give some input here perhaps?

  2. ogoffart commented on May 22, 2015

    @ogoffart

    Hi @gadLinux , thank you for trying to help on this issue.

    The client is no longer using httpf. And is using only very few parts of csync.

    You need to contribute in the client repository. (and in the core)

    You will find the code that uploads files in src/libsync/propagateupload.cpp here you will find the code that split the file in chunks and uploads them.
    Similarily, the code that download the files is in src/libsync/propagatedownload.cpp (this is not using chunks)

    Good luck :-)
    But be warned that i think it is a difficult issue. I don't really know if it is possible to do that on top of webdav so you will probably need some kind of extensions to the protocol.

  3. dragotin commented on May 22, 2015

    @dragotin
    Contributor

    Some brainstorming:

    There needs to be a list of blocks with its according checksums stored on the server for every file. It will be accessible through a special route on the server API.

    The client will need to fetch the list once it detected that an existing file has changed and is to be uploaded. Once the blocklist has arrived, the client needs to recalculate the blocklist on the new, changed file. After that, the client can compare the lists and identify the blocks that have a changed checksum. These are the blocks that need to be uploaded.

    To upload only parts of files, maybe the HTTP PATCH command (RFC) helps. The server needs to be able to handle this command and reassemble the whole file.

    For files that appear new on the client, the client will have to calculate the blocklist and send it along the initial upload to the server to avoid having the server to calculate the list. Also, for each uploaded block, the client will send the new checksum along. The server will either recalculate or invalidate the blocklist for files that were changed on third party storage.

    The client needs to be able to deal with the fact that the server can not provide a blocklist for a file and will transparently fall back to uploading the entire file.

    The kind of checksum is configurable, and will be adjustable by a server configuration later.

  4. danimo commented on May 22, 2015

    @danimo
    Contributor

    A good starting point for a rsync-like approach using HTTP is zsync, aka client-side rsync. I don't think using librsync is feasible, as we want to stick to HTTP(S) as transport protocol.

  5. gadLinux commented on May 25, 2015

    @gadLinux
    Author

    Hi Olivier,

    Thank you for the feedback. I will see what parts are in use on csync.
    Because I have thinking about two approach. One is to implement the
    rsync protocol to transfer the file, and the second one is use something
    like bitttorrent. So it can transfer only the parts needed for it but
    also leave doors open for multiple client sync against same file in a
    decentralized way.

    I suppose that the first way is easier and better for now.

    Let me check the code.

    What's the most recent branch of development in both projects? I found
    there are many and many commits on each branch.

    Best regards,

    El 22/05/15 a las 12:20, Olivier Goffart escribió:

    Hi @gadLinux https://github.com/gadLinux , thank you for trying to
    help on this issue.

    The client is no longer using httpf. And is using only very few parts
    of csync.

    You need to contribute in the client repository. (and in the core)

    You will find the code that uploads files in
    |src/libsync/propagateupload.cpp| here you will find the code that
    split the file in chunks and uploads them.
    Similarily, the code that download the files is in
    |src/libsync/propagatedownload.cpp| (this is not using chunks)

    Good luck :-)
    But be warned that i think it is a difficult issue. I don't really
    know if it is possible to do that on top of webdav so you will
    probably need some kind of extensions to the protocol.

    —
    Reply to this email directly or view it on GitHub
    #16162 (comment).

  6. danimo commented on May 25, 2015

    @danimo
    Contributor

    @gadLinux Please stick with HTTP. Other protocols are not usable in certain scenarios (Port 80 and 443 are always open, others often are not). On top of that, another advantages with the HTTP-based zsync approach is that the server can remain mostly passive, which shifts a lot of load to the client. This improves scalability.

  7. gadLinux commented on May 27, 2015

    @gadLinux
    Author

    Hi,

    So it's important to reimplement solution over HTTP. Okay, I hope I can
    do it this weekend or so.

    Did you think about using thrift?

    Best regards,

    El 25/05/15 a las 11:40, Daniel Molkentin escribió:

    @gadLinux https://github.com/gadLinux Please stick with HTTP. Other
    protocols are not usable in certain scenarios (Port 80 and 443 are
    always open, others often are not). On top of that, there are a number
    of other advantages with the zsync approach (with sits on top of
    HTTP), is that the server can remain mostly passive, which shifts a
    lot of load to the client. This improves scalability.

    —
    Reply to this email directly or view it on GitHub
    #16162 (comment).

  8. ogoffart commented on May 27, 2015

    @ogoffart

    It does not have to be HTTP, but it would be better. (The configuration of an owncloud server has to remain simple). Anyway if it doesn't work we can still fallback to the normal method.

    Anyway, as I said, we are slowly moving away from csync, and new code on the client should be written in C++ in the libsync directory.

    Bittorrent-like protocol would be something different, that opens its own cans of worms (how do you do authantication or security if you are peer to peer?)

  9. danimo commented on May 27, 2015

    @danimo
    Contributor

    and the second one is use something like bitttorrent. So it can transfer only the parts needed for it but also leave doors open for multiple client sync against same file in a decentralized way.

    Do not try to solve two problems at once. The basic idea behind ownCloud is that the server stays in control of the data, so p2p would involve getting a server authorization first. This requires oauth, which is scheduled for one of the next ownCloud server versions. The p2p implementation would then be purely client-side, and not involve the server at all, except for the authorization request.

  10. gadLinux commented on May 28, 2015

    @gadLinux
    Author

    and the second one is use something like bitttorrent. So it can transfer
    only the parts needed for it but also leave doors open for multiple
    client sync against same file in a decentralized way.

    Do not try to solve two problems at once. The basic idea behind
    ownCloud is that the server stays in control of the data, so p2p would
    involve getting a server authorization first. This requires oauth,
    which is scheduled for one of the next ownCloud server versions. The
    p2p implementation would then be purely client-side, and not involve
    the server at all, except for the authorization request.

    Yo are right, I agree. Let me take a look to the partial file sync problem.

  11. jospoortvliet commented on May 28, 2015

    @jospoortvliet

    @gadLinux perhaps it makes sense to have a Skype call about this to avoid a lot of work going in a direction that won't work ;-)

  12. rullzer commented on Jun 30, 2015

    @rullzer
    Contributor

    Ok so I have been looking into this and reading up on zsync (and by extend rsync). And I think this is something that can be done. Luckily the zsync library is available so I'm modifying that to get a POC working. Since at least the upload use case is not what is was designed for.

    I'll hopefully soon put that work on github. So stay tuned. But let me here (quickly) write down how I think this should work.

    Assumptions

    • This only covers the upload scenario (download will follow later, but is easier since it is basically the part zsync tries to solve already)
    • The server has a copy of file F
    • The client has a modified copy of file F, lets call it F-new
    • The server already has the checksum file of F, let call it F-zsync

    Setup

    diagram1

    Server

    The server has only 2 tasks. Store the -zsync files. And generate the new file. This is to keep things scalable and not have the server do all the checksumming.

    We need to come up with a protocol to tell the server how to assemble the new file. I'll be thinking about that.

    We do require space for this to work since you need to copy the original file. And only copy it back once everything is done. Probably locking is also a good idea.

    Client

    In the normal use case of zsync the client figures out which parts are needed from the server. Now we need to find the parts in common with the server. Which parts needs to go. And which parts need to be added. This requires some new code but the info should all be available.

    Since the server is not doing much here all the computational load is shifted to the client. Also in the current setup we trust the clients to generate the zsync files (this is hell in PHP) and send them. From my point of view this is fine since any client can just do a PUT request now anyway.

    I hope to have a POC (in C so easily portable to the client) soonish.

    CC: @danimo

  13. powerpaul17 commented on Jun 30, 2015

    @powerpaul17

    I think it should work this way both for the upload and the download because we already know which file is the "newer" one. The client calculates the parts which have to be transferred and the direction is then depending on the sync status.

    For the upload there should be something like a HTTP PATCH request.

  14. gadLinux commented on Jun 30, 2015

    @gadLinux
    Author

    Hi,

    Looks great! Finally I didn't have time to go into deep. But if you fail
    or need help please let me know.

    Best regards,

    El 30/06/15 a las 09:37, Roeland Douma escribió:

    Ok so I have been looking into this and reading up on zsync (and by
    extend rsync). And I think this is something that can be done. Luckily
    the zsync library is available so I'm modifying that to get a POC
    working. Since at least the upload use case is not what is was
    designed for.

    I'll hopefully soon put that work on github. So stay tuned. But let me
    here (quickly) write down how I think this should work.

      Assumptions
    
    • This only covers the upload scenario (download will follow later,
      but is easier since it is basically the part zsync tries to solve
      already)

    • The server has a copy of file F

    • The client has a modified copy of file F, lets call it F-new

    • The server already has the checksum file of F, let call it F-zsync

      Setup

    diagram1
    https://cloud.githubusercontent.com/assets/45821/8425844/59f2de74-1f0a-11e5-97ba-74444a586d34.jpg

      Server
    

    The server has only 2 tasks. Store the -zsync files. And generate the
    new file. This is to keep things scalable and not have the server do
    all the checksumming.

    We need to come up with a protocol to tell the server how to assemble
    the new file. I'll be thinking about that.

    We do require space for this to work since you need to copy the
    original file. And only copy it back once everything is done. Probably
    locking is also a good idea.

      Client
    

    In the normal use case of zsync the client figures out which parts are
    needed from the server. Now we need to find the parts in common with
    the server. Which parts needs to go. And which parts need to be added.
    This requires some new code but the info should all be available.

    Since the server is not doing much here all the computational load is
    shifted to the client. Also in the current setup we trust the clients
    to generate the zsync files (this is hell in PHP) and send them. From
    my point of view this is fine since any client can just do a PUT
    request now anyway.

    I hope to have a POC (in C so easily portable to the client) soonish.

    CC: @danimo https://github.com/danimo

    —
    Reply to this email directly or view it on GitHub
    #16162 (comment).

  15. 62 remaining items

  16. added 2 commits that reference this issue on Dec 17, 2017
    1b1e72f
    6dbdb02
  17. added a commit that references this issue on Jan 15, 2018
    90e18fa
  18. added 2 commits that reference this issue on Jan 16, 2018
    975f1c3
    0e0ab09
  19. gadLinux commented on Mar 27, 2018

    @gadLinux
    Author

    Is this finally merged? and bounty claimed?

  20. PVince81 commented on Mar 27, 2018

    @PVince81
    Contributor

    The server side code was merged at least

  21. guruz commented on Mar 20, 2019

    @guruz
    Contributor

    This feature will be in the upcoming 2.6 alpha release.
    Meanwhile you can try it inside the daily builds 2.6.x https://download.owncloud.com/desktop/daily/

  22. added a commit that references this issue on Apr 12, 2019
    7379b30
  23. locked as resolved and limited conversation to collaborators on Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions