direct write patch

David Bolen db3l at fitlinxx.com
Tue Nov 13 07:10:28 EST 2001


Don Mahurin [dmahurin at berkeley.innomedia.com] writes:

> Perhaps, all that I need is a "--delete-before-update" option that
> just unlinks the file before it starts to write the temp file. Then
> we avoid the possible issues that you raised.  I can still see a
> case where --direct-write may be useful (read-write file in a
> read-only dir), but this is probably not a common situation, and I
> don't want to tackle those issues yet.

But that would defeat the rsync algorithm, since it is reading from
the original file while writing the temp file (in order to copy over
unchanged blocks to optimize the transfer).  So you need the original
while constructing the new version.

This is also true for directly overwriting the original file, since
the algorithm depends on being able to reference blocks from that
original file at any point in the transfer.  By overwriting it you
risk corruption of the final file if rsync wants to reuse a block from
early in the file late in the transfer, which you could have already
overwritten.  It doesn't appear that your original patch takes this
into account (unless you are also forcing -W and disabling the rsync
protocol if your new option is used).

In this respect, rsync is a tradeoff of local CPU and disk space on
either side of the connection in order to optimize the traffic between
the two.  It needs that space (and computation time) to determine how
to most efficiently communicate the file differences.  I have a
feeling that trying to reduce the disk space needs is going to be
counter-productive since it goes against the fundamental tradeoffs
inherent in rsync.

-- David

/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/




More information about the rsync mailing list