Storage compression patch for Rsync (unfinished)

jw schultz jw at pegasys.ws
Mon Jan 27 01:47:03 EST 2003


On Sun, Jan 26, 2003 at 02:46:43PM -0800, Craig Barratt wrote:
> > Is there any reason why caching programs would need to set the
> > value, rather than it just being a fixed value?
> > I think it is hard to describe what this is for and what it should be
> > set to.  Maybe a --fixed-checksum-seed option would make some sense,
> > or for a caching mechanism to be built in to rsync if it is shown to
> > be very valuable.
> 
> A fixed value would be perfectly ok; the same magic value that batch
> mode uses (32761) would make sense.
> 
> > I know people have proposed some caching mechanisms in the past and
> > they've been rejected for one reason or another.
> 
> One difficulty is that additional files, or new file formats, are needed
> for storing the checksums, and that moves rsync further away from its
> core purpose.
> 
> > I don't think I'll include the option in 2.5.6.
> 
> If I submitted a new patch with --fixed-checksum-seed, would you be
> willing to at least add it to the patches directory for 2.5.6?
> 
> I will be adding block and file checksum caching to BackupPC, and
> that needs --fixed-checksum-seed.  This will save me from providing
> a customized rsync (or rsync patches) as part of BackupPC; I would
> much rather tell people to get a vanilla 2.5.6 rsync release and
> apply the specific patch that comes with the release.

Block checksums come from the receiver so cached block
checksums are only useful when sending to a server which had
better know it has block checksums cached.  It should be
relatively easy to add a test prior to setup_protocol()
to determine if block checksums are cached.  Given those
circumstances it shouldn't be necessary to add any
command-line option for this.  Further, that test could  
set the checksum_seed so setup_protocol could test
checksum_seed to see if it is alread set and not alter it
eliminating the need for a checksum_seed_set.

In fact doing as above and moving checksum_seed =
FIXED_CHECKSUM to the places in options.c where read_batch
and write_batch are set would allow reducing the
checksum_seed portion of setup_protocol like so:

        if (remote_version >= 12) {
                if (am_server) {
-                   if (read_batch || write_batch) /* dw */
-                       checksum_seed = 32761;
-                   else
-                       checksum_seed = time(NULL);
+                       if(!checksum_seed) checksum_seed = time(NULL);
                        write_int(f_out,checksum_seed);
                } else {
                        checksum_seed = read_int(f_in);
                }
        }

Not only simplifying the code but i think rendering it more
understandable.

To save someone from looking, checksum_seed is initialized
to 0 as part of the declaration in checksum.c 


-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt



More information about the rsync mailing list