Changed attributes for a file in destination that is hard linked get propagated to --link-dest directories

Robert Bell Robert.Bell at csiro.au
Tue Jan 22 19:55:13 MST 2013


Folks,

Thinking again about the issue of

   changed attributes for a file in source that is identical in content
   to a file in destination that is hard linked get propagated to the
   --link-dest directories


I would like to suggest a new flag, (perhaps called something like
--preserve-linked-attributes), to allow callers to get the
behaviour that is needed to allow the use of recycled destination
directories and have attributes preserved back in time.

So,

if destination file is unchanged but destination attrs are changed
   if --new-flag is set and if the link-count of the destination file is > 1
     create a new copy of the file and attrs
     # from the source, but could copy the file in the destination
     # and update attrs, and remove the old file
   else
     # current behaviour
     update just the attributes
   endif
endif

Or, in the terms used in previous posts:

if ( destination unchanged_file() is true and unchanged_attrs() is false)
....


The test on the link-count is done, since teh new behaviour is needed
only when the target file has a link-count greater than 1.


Regards
Rob. Bell              e-mail: Robert.Bell at csiro.au
--
Dr Robert C. Bell, BSc (Hons) PhD
Technical Services Manager
Advanced Scientific Computing
CSIRO IM&T

Phone: +61 3 9669 8102 | Mobile: +61 428 108 333 | CSIRO 93 3810
Robert.Bell at csiro.au | http://www.csiro.au/ | http://www.hpsc.csiro.au/
Addresses:
Street: CSIRO ASC Level 11, 700 Collins Street, Docklands Vic 3008, Australia
Postal: CSIRO ASC Level 11, GPO Box 1289, Melbourne Vic 3001, Australia

PLEASE NOTE

The information contained in this email may be confidential or
privileged. Any unauthorised use or disclosure is prohibited. If you
have received this email in error, please delete it immediately and
notify the sender by return email. Thank you. To the extent permitted
by law, CSIRO does not represent, warrant and/or guarantee that the
integrity of this communication has been maintained or that the
communication is free of errors, virus, interception or interference.

Please consider the environment before printing this email.



This means that recycling directories, which as Teodor Milkov noted:

>  "Such a behaviour (unlink changed files and then hard link to dest dir)
>  would be very handy, because rotating large directory trees (e.g. 10
>  milion files, 10k files changed) is sooo much more efficient than
>  deleting them and then repopulating from scratch."

is an issue as Wayne noted:

>  "A pre-existing hard-linked copy of the files causes rsync to
>  just change the attributes on the file in-place (without breaking the
>  hard-link).  This can be a minor point for some people (if historical
>  permissions/ACLs/xattrs don't need to be accurate), but could be a deal
>  breaker for some."

I can see the need for another rsync option here to allow users to
select the making of a fresh copy of the file in this case.  That would
restore the behaviour I implicitly assumed we had, but didn't.

I've updated the documentation for our backups, and prepared a note for
users.  I'm also thinking about ways around this issue, none of which
are particularly appealing:
  - drop the recycling of old directories (parameterised in our set-up)
  - break the linking at regular intervals (parameterised in our set-up)
  - do a dry run to identify changed files, delete those on the
    destination, and then do a non-dry run (there are timing issues here,
    but there always will be for a non-quiet filesystem).

Thanks again

Regards
Rob. Bell              e-mail: Robert.Bell at csiro.au
--
Dr Robert C. Bell, BSc (Hons) PhD
Technical Services Manager
Advanced Scientific Computing
CSIRO IM&T

Phone: +61 3 9669 8102 | Mobile: +61 428 108 333 | CSIRO 93 3810
Robert.Bell at csiro.au | http://www.csiro.au/ | http://www.hpsc.csiro.au/
Addresses:
Street: CSIRO ASC Level 11, 700 Collins Street, Docklands Vic 3008, Australia
Postal: CSIRO ASC Level 11, GPO Box 1289, Melbourne Vic 3001, Australia

Please see earlier postings for the disclaimer.



More information about the rsync mailing list