Skip to content
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

Use rsync flags consistently for local and remote copy #12715

Merged
merged 3 commits into from
Jan 18, 2024

Conversation

roosterfish
Copy link
Contributor

@roosterfish roosterfish commented Jan 9, 2024

The rsync --checksum flag has a history in LXD which ultimately led to the fact that remote container copies can be faster than local ones:

  1. 64fd7f9 initially added it in with the note TODO: Not sure we need this option.
  2. a88e667 removed it since it is causing significant IO
  3. 6518166 added it back in since the rsync version 3.1.1 back then didn't had support for checking the files modification times on nanoseconds granularity
  4. 47f4509 moved it into lxd/rsync.go without any changes

Today rsync still doesn't check for nanoseconds by default but you can now set --modify-window=-1 to a negative value which will cause a check for nanoseconds starting from version 3.1.3 (from man rsync):

When comparing two timestamps, rsync treats the timestamps as being equal if they differ by no more than the modify-window value. The default is 0, which
matches just integer seconds. If you specify a negative value (and the receiver is at least version 3.1.3) then nanoseconds will also be taken into ac‐
count. Specifying 1 is useful for copies to/from MS Windows FAT filesystems, because FAT represents times with a 2-second resolution (allowing times to
differ from the original by up to 1 second).

The LXD snap uses rsync version 3.2.7. This was discovered in #12668

Starting with rsync 3.1.3 using a negative window will take nanoseconds into account.

Signed-off-by: Julian Pelizäus <[email protected]>
@tomponline tomponline merged commit 4f9b618 into canonical:main Jan 18, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants