Repository navigation
Description
(Q) Currently rclone provides copy and sync commands spinning around three basic traits (hashsum, modtime, size) to detect changes using internal equal() function and its helpers.
The latter used to grow organically in response to the stream of change detection feature requests, often serving contradictory user requirements such as consistency (this PR #4011 (comment)), cost savings (see #2889 (comment)) and many others (sometimes unexplained ;)), consequently blurring the line between "bug" ang "feature".
This in turn has led to a number of change-related CLI flags (see https://rclone.org/flags), some of them having negative (no-check), conditional (x-if-y) or even double-negative (noignore) names, which interact in exotic ways with 30+ supported backends (https://rclone.org/overview#features) and their (in)ability to provide required traits.
On top of that we have filtering flags and thin difference of sync vs copy. I feel that many users have problems telling it, and documentation doesn't stress enough.
In the end we might expect that any behavior can be requested, even that that feels esoteric or illogical.
¯\_(ツ)_/¯
(A) This feature request is up to:
- inventory existing flags related to change detection
- assign ordering priorities (weights?) to flags and conditions
- describe which flag(s) win if they are used in combination
- probably develop a syntax similar (in idea) to Unix PAM (see https://linux.die.net/man/5/pam.conf or https://docs.ansible.com/ansible/latest/collections/community/general/pamd_module.html#examples) or NSS directives (https://linux.die.net/man/5/nsswitch.conf)
- (I started thinking about CSS rule weights but stopped myself ;))
- see whether existing flags can be described by the new syntax
- make it as simple as possible (think okkam's razor)
- revise test coverage, make sure existing shell wrappers around rclone don't break
- add a simple enough automata in equal to handle the logic
- add a combined flag like
--change-criteria +size,-hash,!modtime,?whateverwith a syntax reach enough to cover existing and esoteric cases - improve docs: add examples
- improve docs: map the combined flag on existing flags
- improve docs (other)
This seems like a big effort covering <5% of user base. OTOH there is a generalization PR #3782 (multiwrite union) that has been a success.
(spun off the #4011 (comment))
Activity
ivandeex commentedon Nov 26, 2020
NOTE: this comment was actually written by @ncw, I just copied it here from #4011 (comment)
I think we could inventory the flags to see where we are at.
However I don't want to break backwards compatibility, so if we want to change stuff then we need to do so careful!
The
equalfunction has been reasonably stable, I think the only thing added to it recently is --refresh-times - which is a very specialised options.User demand is how rclone has gained new features, though we need to be careful to push back on ones which aren't of general interest.
Indeed. N-flags * N-providers * N-options-per-provider is a big number.
More docs for
syncandcopywould be appreciated. Thesyncpage has lots of warnings on now as a result of user accidents.Yes, users want to get their stuff done, it is our job to keep rclone consistent!
I'll just copy the comment here
I think that is a good plan to control the complexity.
Making a generalised solution will mean that advanced users will have somewhere to go when then need to get stuff done, but hopefully a much smaller subset of flags will cover the main use cases (eg --checksum, --size-only).
I like that idea. We could implement it then deprecate flags which we don't like. (You can hide flags so they still work but are hidden).
Great idea.
I especially like your moratorium on adding more complexity to what we've got already.
Do you want to make an issue, then we can think about all the things which might need to be controlled?
ivandeex commentedon Nov 28, 2020
Related to #4815 (separate "sync" page in docs)
ivandeex commentedon Jun 11, 2021
Let me copy here few bits of the discussion about
non-commutiveflags andrclonicfile comparison from #5164 (comment) and #5164 (comment) to prevent having it buried.Filters
Why are the filters different? The only one of concern is
--exclude-if-presentwhich can cause issues with bi-directional sync. The following is the note I include in my readme about them:This isn't a new problem in bisync from regular rclone though I do see it amplified for it.
--exclude-if-present
We have open bug reports (#4523) about this.
We have requests (#4753, #4793) to add more non-commutive flags.
We try (#4011, #4856) to restrain reasonably.
rclonicfile comparisonThe heart of rclone's omnivory change detection (runtime) lies around operations.equal, operations.checkHashes, et cetera. It's kept afloat by the astute test framework, in particular fstest.CheckListing, fstest.CheckHashes, fstest.CheckTime and [drums] retrying.
This code is not big in terms of LOC but its perceived complexity is very high..... while users continue to request for even more change detection and filtering features :-(
Standing on the shoulders of
rsyncUnfortunately rclone has already diverged (#1228, #3375, #5040, #5043, docs) from rsync
We can't easily fix that due to backwards compatibility concerns so there exists a waiting proposal (#4776) of
rclone rsyncbesidesrclone sync.CC @ncw @jwink @ivandeex
ivandeex commentedon Jun 16, 2021
(https://forum.rclone.org/t/syncing-timestamps-when-using-checksum/24744/12)
Yet another mode unsupported by current set of flags:
ivandeex commentedon Oct 10, 2021
Related feature request:
https://forum.rclone.org/t/copy-overwrite-rules-size-rule/26807
ivandeex commentedon Nov 18, 2021
ncw commentedon Nov 18, 2021
I'm beginning to think that if we want to support all the things users want to do with syncing we are going to need to provide a scriptable sync engine... So imagine a (insert scripting language) fragment which dealt with the sync flow.
ivandeex commentedon Nov 18, 2021
Still feels vague to me.
Will understand when we collect enough cases, allocate time and start architecting the change detection engine.
The 90% cases are already covered by existing flags.
When we design engine for remaining 10%, we a free to decide that we prefer
some NSS-like notation backed by a state machine that covers 90% of remaining 10% rather than embedding a LUA-like script.
The unlucky 1% (10% of 10%) will be left for users to script around CLI/API. Excuse? rclone is not Santa Claus! :-)))))))
ivandeex commentedon Nov 18, 2021
advanced change engine is expected to support behavior like the patch below
rclone/vfs/vfscache/item.go
Lines 584 to 592 in 34c28b2
Note that this case compares a vfs cache item against a remote object rather than two remote objects!
If we are going to support this, the change engine must be implemented as an isolated library!
ivandeex commentedon Nov 19, 2021
ivandeex commentedon Nov 19, 2021