rclone/fs/operations
nielash b4216648e4 bisync: full support for comparing checksum, size, modtime - fixes #5679 fixes #5683 fixes #5684 fixes #5675
Before this change, bisync could only detect changes based on modtime, and
would refuse to run if either path lacked modtime support. This made bisync
unavailable for many of rclone's backends. Additionally, bisync did not account
for the Fs's precision when comparing modtimes, meaning that they could only be
reliably compared within the same side -- not against the opposite side. Size
and checksum (even when available) were ignored completely for deltas.

After this change, bisync now fully supports comparing based on any combination
of size, modtime, and checksum, lifting the prior restriction on backends
without modtime support. The comparison logic considers the backend's
precision, hash types, and other features as appropriate.

The comparison features optionally use a new --compare flag (which takes any
combination of size,modtime,checksum) and even supports some combinations not
otherwise supported in `sync` (like comparing all three at the same time.) By
default (without the --compare flag), bisync inherits the same comparison
options as `sync` (that is: size and modtime by default, unless modified with
flags such as --checksum or --size-only.) If the --compare flag is set, it will
override these defaults.

If --compare includes checksum and both remotes support checksums but have no
hash types in common with each other, checksums will be considered only for
comparisons within the same side (to determine what has changed since the prior
sync), but not for comparisons against the opposite side. If one side supports
checksums and the other does not, checksums will only be considered on the side
that supports them. When comparing with checksum and/or size without modtime,
bisync cannot determine whether a file is newer or older -- only whether it is
changed or unchanged. (If it is changed on both sides, bisync still does the
standard equality-check to avoid declaring a sync conflict unless it absolutely
has to.)

Also included are some new flags to customize the checksum comparison behavior
on backends where hashes are slow or unavailable. --no-slow-hash and
--slow-hash-sync-only allow selectively ignoring checksums on backends such as
local where they are slow. --download-hash allows computing them by downloading
when (and only when) they're otherwise not available. Of course, this option
probably won't be practical with large files, but may be a good option for
syncing small-but-important files with maximum accuracy (for example, a source
code repo on a crypt remote.) An additional advantage over methods like
cryptcheck is that the original file is not required for comparison (for
example, --download-hash can be used to bisync two different crypt remotes with
different passwords.)

Additionally, all of the above are now considered during the final --check-sync
for much-improved accuracy (before this change, it only compared filenames!)

Many other details are explained in the included docs.
2024-01-20 16:08:06 -05:00
..
operationsflags sync: report list of synced paths to file -- see #7282 2024-01-20 14:50:08 -05:00
check_test.go check: respect --no-unicode-normalization and --ignore-case-sync for --checkfile 2024-01-20 14:50:08 -05:00
check.go operations: add logger to log list of sync results -- fixes #7282 2024-01-20 14:50:08 -05:00
copy_test.go operations: fix invalid UTF-8 when truncating file names when not using --inplace 2023-10-29 14:04:37 +00:00
copy.go operations: fix server side copies on partial upload backends after refactor 2023-10-30 16:50:19 +00:00
dedupe_test.go test: replace defer cleanup with t.Cleanup 2022-12-09 14:38:05 +00:00
dedupe.go accounting: Make checkers show what they are doing 2023-03-01 11:10:38 +00:00
listdirsorted_test.go test: replace defer cleanup with t.Cleanup 2022-12-09 14:38:05 +00:00
logger.go sync: report list of synced paths to file -- see #7282 2024-01-20 14:50:08 -05:00
lsjson_test.go rc: fix operations/stat with trailing / 2023-03-22 16:22:45 +00:00
lsjson.go lsjson: make --stat more efficient 2023-04-28 14:31:05 +01:00
multithread_test.go operations: fix overwrite of destination when multi-thread transfer fails 2023-11-24 11:19:58 +00:00
multithread.go operations: use built in io.OffsetWriter for go1.20 2024-01-15 16:22:07 +00:00
operations_internal_test.go fs: deglobalise the config #4685 2020-11-26 16:40:12 +00:00
operations_test.go moveOrCopyFile: avoid panic on --dry-run 2024-01-20 14:50:08 -05:00
operations.go bisync: full support for comparing checksum, size, modtime - fixes #5679 fixes #5683 fixes #5684 fixes #5675 2024-01-20 16:08:06 -05:00
rc_test.go operations: add operations/check to the rc API 2023-10-04 17:52:57 +01:00
rc.go operations: add operations/check to the rc API 2023-10-04 17:52:57 +01:00
reopen_test.go operations: make Open() return an io.ReadSeekCloser #7350 2023-11-20 18:07:05 +00:00
reopen.go operations: make Open() return an io.ReadSeekCloser #7350 2023-11-20 18:07:05 +00:00