[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Question on copies implementation

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2006-11-08 18:11:44 CET

Andrea Aime wrote:
> Hi all, I'm trying to design a versioning system for spatial data
> held in a database (if you're curious, see here:
> http://docs.codehaus.org/display/GEOS/Versioning+WFS), and I have a
> question after reading the design doc at:
>
> http://subversion.tigris.org/design.html
>
> One thing I'm sure I do not understand is the relation between diffs
> and branches. On the diff section you say that you store reverse
> diffs and only the latest revision is a full copy.

That's true for the BDB backend; the FSFS backend stores forward deltas.

> Moreover, on the branch/tag sample the cheap copy is defined as a
> simple pointer to the previous revision.
>
> Let's say I do open a branch, and there's a file A. Now I do modify
> it in the branch, going to revision N. Does this mean that the full
> text version of the file is now attached to the branch only, and to
> get to the trunk version I do have to perform a reverse diff? And the
> same goes if the same file is afterwards modified on trunk? The full
> version is now attached to trunk, and a reverse diff has to be
> performed to get to the branch, and so on?

That's not quite correct. It's complicated. If you make a branch (from
HEAD-at-the-time) and commit a change to a file, then (in a simple
world) file-on-branch will be fulltext, and its predecessor (which is
file-on-truck) will be deltafied against that new fulltext. But the
next time you change file-on-trunk, you now have two fulltexts.

             ,---[B]
            /
   ------[A]-------------[A']
          t0 t1 t2

At t0, A is a fulltext. At t1, you've copied A to B; B is now a
fulltext, and A is a delta against B. At t2, A' is a new fulltext, A is
now a delta against A', and B remains a fulltext. So, in the general
case, there is a fulltext at the tip of every branch in a file's version
history.

Now, reality is more complicated, because we have this "skip delta"
concept in the mix. With "skip deltas", we re-deltify ancestors of a
new node revision against the new fulltext (so we reduce the number of
deltas that need to be applied to reconstitute the fulltext of a older
revision). For example, if I change file-on-trunk, we re-deltify its
4th-, 8th-, 16th-, and 32nd-level ancestors against itself (or something
like that).

-- 
C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on Wed Nov 8 18:12:36 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.