Rsync and tbdiff

Richard Maw richard.maw at codethink.co.uk
Wed Nov 9 17:52:46 GMT 2011


Trebuchet diff is the program used to make and apply patches.
The patches are transmitted to the target device and then applied by the
device to update itself.
It was pointed out that rsync has a batch mode option that allows the
same behaviour, however it has been decided that it is not suitable.

The default mode for patch creation uses the "quick check" algorithm,
which uses the heuristic of if a file has the same modification time and
size then it does not need to be updated.
However in use, it was found that this, while accurate for most files,
was not correct for all files.
Binary formats often keep the same file size and some files do not have
their modification times set correctly.
In some cases the timestamps were not identical, but had precision of
less than a second, which rsync interpreted as being the same.

To be sure that files need to be patched they should be read. This is
slow as it has to traverse an entire filesystem, but patches are only
created once, so they are allowed to be reasonably slow.

One option is to use --ignore-times, which forces all files to be
transmitted, however this makes the patches larger and the patch
creation take a long time. I had a job running all night and not finish,
while tbdiff did it in less than 10 minutes.

Another option is to use checksums with --checksum. This will read the
files and calculate if they need to be altered by comparing the
checksums. This slows down the patch creation, but to an acceptable
level.
However when deploying the patch it took 12 times longer than tbdiff.
This is presumably because it has to checksum every file that needs to
be altered. This sounds like a good idea, as it means a bad version
can't be created if the files have been corrupted, however patches are
applied to subvolumes the user shouldn't have access to, and if disk
failure is happening there's not too much that can be done anyway.
We need to be able to assume the files are correct for an acceptable
speed.
Fast deployment is important to baserock, so rsync is not suitable.

A summary of these points and some tables of the relative times are on
the wiki at http://wiki.baserock.org/Trebuchet/tbdiff

If somebody knows of a way to make rsync skip checksumming in batch
deployment then please, let us know so we can have the features of
rsync, but the speed of tbdiff.





More information about the baserock-dev mailing list