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

Re: How can svn_fs_abort_txn be implemented?

From: Jim Blandy <jimb_at_zwingli.cygnus.com>
Date: 2001-02-27 15:49:43 CET

Yoshiki Hayashi <yoshiki@xemacs.org> writes:
> Jim Blandy <jimb@zwingli.cygnus.com> writes:
>
> > > There's an argument for making the nodes immutable when
> > > close_file is called. You can't do it or you won't be able
> > > to distinguish which nodes were created in that transaction.
> >
> > Yes, you can. Any mutable node reachable from a transaction root
> > belongs to that transaction only. Mutable nodes are always private to
> > the transaction they were created in; they never appear in more than
> > one transaction's tree. So you just start from the transaction's
> > root, and delete nodes until you hit mutable nodes.
> ^^^^^^^ immutable?

Yes, sorry, I meant immutable.

> Say fs revision 10 has following structure (number below
> each path component represents node revision ID and M means
> the node is mutable):
>
> /project/subversion/subversion/libsvn_fs/dag.c
> (0.8) (1.6) (2.4) (3.4) (4.3)
> dag.h
> (5.3)
>
> Then, dag.c is changed in working copy and all the necessary
> changes are done except svn_fs_commit_txn() or
> svn_fs_abort_txn().
>
> /project/subversion/subversion/libsvn_fs/dag.c
> (0.9) (1.7) (2.5) (3.5) (4.4)
> M M M M M
> dag.h
> (5.3)
>
> Suppose svn_fs_abort_txn() is called here. You need to
> remove revision node ID 0.9, 1.7, 2.5, 3.5, 4.4 from nodes
> table or you'll end up having many stray nodes in the table.
> Luckily, all these freshly created revisions are mutable and
> can be easily distinguished from other already existent node
> like dag.h. So what svn_fs_abort_txn() will do is to remove
> all mutable nodes reachable from root node of given
> transaction.

Right.

> If you made any node immutable, you'll lose information
> about which node is new. If dag.c is marked immutable when
> close_file is called, tree will look like:
>
> /project/subversion/subversion/libsvn_fs/dag.c
> (0.9) (1.7) (2.5) (3.5) (4.4)
> M M M M
> dag.h
> (5.3)
>
> Here, you can't tell dag.c or dag.h is created in this
> transaction unless you record every new node revision IDs in
> another table. If svn_fs_abort_txn() is called, dag.c(4.4)
> and dag.h(5.3) remain in nodes table, dag.c(4.4) being
> referenced from nowhere. Therefore, you can't make any
> mutable nodes immutable before svn_commit_txn() takes place.
>
> Is this view correct?

That's correct. All nodes changed so far in a given transaction are
mutable. Nodes only become immutable when they are committed, and
become part of a revision.
Received on Sat Oct 21 14:36:23 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.