The Samba-Bugzilla – Bug 10567
--abort option to halt transfer on error(s)
Last modified: 2014-04-26 10:34:57 UTC
Currently if the source of an rsync transfer goes down for whatever reason, rsync will forge on, reporting errors for every file that is now missing (reporting "file has vanished") until it runs out of known files to look for.
In most cases this is wasted effort, so I think it would make sense to allow rsync to simply abort in such cases. Here is a suggestion for options that could be used to control this:
--abort: This option indicates that rsync should abort the transfer if an error occurs. It can optionally be supplied with a value that determines what class of errors will cause the abort, so that it will only abort for missing files as opposed to other issues such as long path-names.
--abort-threshold: This option supplies a number of errors that will cause rsync to abort. If you're syncing a static hierarchy then you may set this low, as there should be no errors at all due to changes during a sync. A positive number indicates that the threshold is for total errors during the transfer, while a negative value indicates a number of consecutive errors that will trigger an abort. Two options can be set in order to set both types of threshold.
--abort-partial: This option indicates that rsync should discard any partial transfers rather than leaving them for completion later. This also indicates that any completed files not yet moved into position should also be discarded.
--abort-delete: This option indicates that rsync shouldn't attempt to carry out any pending deletions (regardless of this option rsync shouldn't attempt to delete any files which produced errors, in case they're only temporarily missing).
Anyway, this should allow us greater control of how and when rsync fails if we encounter unexpected circumstances. This will be particularly useful when syncing between devices that may not always be present, or may be disconnected during an operation.