On Fri, 2005-12-16 at 12:15 -0600, Ben Collins-Sussman wrote:
> I'm confused about the meaning of the 'txn_id' field in
> libsvn_fs_base/fs.h:representation_t:
>
> /* transaction ID under which representation was created (used as a
> mutability flag when compared with a current editing
> transaction). */
> const char *txn_id;
>
> Now, I've heard cmpilato talk about our famous node-rev-id x.y.z
> triplets, and how the 'z' part is the transaction the node was created
> in, and how it can be examined to decide if the node is mutable or
> not.
>
> But I'm not understanding how this concept plays with representations.
> The docstring suggests something similar about being a mutability
> flag, and if you look at reps-strings.c:1552 or so, our deltification
> explicitly sets the field to NULL when writing out a new rep. Is that
> a bug? Or is it intentional.
>
> I suspect cmpilato is the best person to de-confuse me here. :-)
[cmpilato digs deeeeeep into his memory]
For node-revisions, whose IDs have the x.y.z triplet thing, the z
component (the TXN_ID) represents the transaction in which the node was
created. Because node-revisions are never modified after they are
committed, and are only "visible" via the transactions in which they are
created, the TXN_ID component acts as a sort of mutability flag, a
signal to the node-cloning algorithm that, hey, we've already cloned the
node that lives at /some/fs/path, so let's not do it again.
Representations are a little different in that they can get tweaked well
after they are solidified as part of a Subversion commit (by, as you
found, the deltafication system). But deltafication doesn't occur as a
process of a commit transaction -- it's a process that happens only on
representations that have achieved permanency by virtue of being
associated with a committed node-revision. Thus, when representations
that have been deltafied are rewritten later, there is no TXN_ID to
associate with them.
Now, unfortunately I can't recall why I chose to make the newly
deltafied representation use TXN_ID == NULL instead of inheriting the
TXN_ID of the representation on which it was based. But I also can't
think of any reason why it would matter.
--
C. Michael Pilato <cmpilato@collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand
Received on Fri Dec 16 20:46:13 2005