No --delete-after?

Dave Dykstra dwd at bell-labs.com
Thu Jan 31 07:03:19 EST 2002


On Wed, Jan 30, 2002 at 10:17:13AM -0500, Mack, Daemian wrote:
> > On Fri, Dec 21, 2001 at 04:05:01PM -0500, Mack, Daemian wrote:
> > > I can get --delete to work, but I'd prefer to delete files only on a
> > > successful transfer, to ensure that the end-user has a 
> > working collection of
> > > files, no matter what release.  For some reason, 
> > --delete-after does nothing
> > > for me, even as administrator on the Win2k box that's 
> > acting as a client.
> > > 
> > > 
> > > Daemian Mack
> > 
> > --delete is already not supposed to delete anything if there 
> > are any errors
> > on the sending machine.  Are you in particular concerned 
> > about errors on
> > the receiving machine?  I've never used --delete-after, but 
> > in looking at
> > the code it looks it should move all the deletes to after all 
> > the files
> > have been received.  Can you itemize a series of simple 
> > steps, starting
> > from scratch, that demonstrates the problem you're seeing?
> 
> Sorry it's taken me so long to get back to this problem. 
> 
> Here's how I recreated this problem this morning: on the rsync server, I
> created an rsync area called zorn with, say, 8 files and one subdirectory.
> In that subdirectory are three or four files.
> 
> I synced that over to the client machine with 
> 
> 	rsync --archive --verbose --checksum --times --modify-window 2
> --delete-after --force 10.8.1.179::zorn /cygdrive/c/zorn
> 
> I checked out /cygdrive/c/zorn -- all files were local and accounted for,
> including that subdirectory and its contents.
> 
> Then, I deleted that subdirectory off of the server's zorn rsync area.  I
> confirmed that it and its contents were gone.  Then, repeated the client's
> rsync maneuver:
> 
> 	rsync --archive --verbose --checksum --times --modify-window 2
> --delete-after --force 10.8.1.179::zorn /cygdrive/c/zorn
> 
> Checking local /cygdrive/c/zorn shows that subdirectory and its contents
> *are still there.*
> 
> If I drop "--delete-after force" in favor of "--delete --force", it works as
> I planned, by deleting that subdirectory and its contents.

I meant for you to come up with a simple example from scratch that would
allow anybody to reproduce it.  Something like this:

    mkdir s t
    touch s/f1 t/f1 t/f2
    rsync -avc --delete-after s/ t/

Indeed it does not delete anything.  I see that if I add the --delete
option it does work, but the --delete-after option modifies the behavior of
--delete-after to do the deletes at the end instead of the beginning.  So
I conclude that --delete-after only modifies the behavior if --delete, it
does not imply --delete.  Probably it should.  I know that --delete-excluded
implies --delete.  The man page certainly doesn't indicate that you need
to add --delete with one but not the other.



> I'm unclear on all the details concerning the delete switch (especially
> lately), but as I understand it, the distinction between --delete and
> --delete-after is that --delete-after will queue local deletes until after
> the rsync process is satisfied that the two data areas are otherwise
> perfectly in sync.  I'd very much like to make sure nothing is deleted on
> the client machine unless and until the rsync process completes everything
> else perfectly, as I'm responsible for pushing out automatic updates to
> clients' executables, and it's far preferable to leave them with a working
> but older version of the code rather than a partially new version.  Which, I
> suppose, goes without saying.  ;)

If you've followed the discussion on --compare-dest lately, you may realize
that doing the deletes at the end may not be sufficient for what you want.
It's possible that an update will require multiple files to be updated
together, and if some but not all of them get transferred you can have a
broken installation.  In my software distribution system based on my NSBD
program (see http://www.bell-labs.com/nsbd) I always make sure that all
updates are pulled into a separate directory (using rsync --compare-dest
actually) and when everything is successfully transferred to the client
machine I quickly move all the files into place and then do deletes.  If
you were using only rsync and a simple wrapper script you could probably
do something similar, although probably you'd need to run rsync twice,
once with --compare-dest and no --delete, and once with --delete and no
--compare-dest.

- Dave Dykstra




More information about the rsync mailing list