Re: zero delta changes

Donovan Baarda <[email protected]> Fri, 09 Mar 2007 11:17:48 +0000
Newsgroups gmane.network.librsync.general
Organization http://minkirri.apana.org.au/~abo/
Message-ID <[email protected]>
On Thu, 2007-03-08 at 01:27 -0500, Shirish H. Phatak (Personal) wrote:
> A whole file hash is probably the way to go, though you can detect a single
> copy command as Donovan has suggested, parse it and see if the length of the
> copy matches the file size.
> 
> However an interesting case we have run into is appends or truncates. In
> either case, we end up doing unnecessary copies when a simple write to
> end/truncate the file would suffice. I have debated whether this is a
> problem best solved during patch application or whether the delta generation
> should incorporate new commands for "skipping" byte offsets in the source.
> The former sounds more natural to me, but I was wondering if anyone had any
> thoughts on optimizing these cases.

My gut feeling is that these are relatively minor corner-cases that
don't justify the extra complexity. A simple truncate or append delta is
going to be much faster to apply than a more typical complicated delta
even without special-case optimizing it.

This also seems to be a special sub-case of a more general in-place
delta and/or patch problem. It would be more useful to have something
that can generate or identify delta's that can be applied in-place than
special-casing truncate/append.

> Thanks...
> 
> -Shirish
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Martin
> Pool
> Sent: Wednesday, March 07, 2007 9:12 PM
> To: Donovan Baarda; Sujit Jagdev; [email protected]
> Subject: Re: [librsync-users] zero delta changes
> 
> On 08/03/07, Donovan Baarda <[email protected]> wrote:
> ]> > I need to know how I can detect a zero change delta ( ie a delta that
> > > signifies that no change is required)
> > >
> > > I am attaching some "zero change" deltas.
> >
> > A zero change delta consists of a "single copy" command. This command
> > includes a length, so you will get different "zero delta" files for
> > different length files. You also get a "single copy" command for a file
> > that has been truncated, so it's not that trivial to check if the single
> > copy command is really a "zero delta" or a truncation.
> 
> If I recall correctly you can ask for statistics which will tell you
> there are no literal insertions, but this does not quite tell you that
> there are no deletions or rearrangements.  Maybe you can get the
> whole-file hash from the header?
> 
-- 
Donovan Baarda <[email protected]>
http://minkirri.apana.org.au/~abo/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV