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

Re: Move using initial state

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Tue, 10 Sep 2013 11:28:10 +0100

Greg Stein <gstein_at_gmail.com> writes:

> On Mon, Sep 9, 2013 at 11:29 AM, Julian Foad <julianfoad_at_btopenworld.com> wrote:
>> Philip Martin wrote:
>>> The current Ev2 has atomic add for files and directories, it doesn't
>>> attempt to reuse the alter operations by adding "empty" nodes and then
>>> altering those empty nodes. The current Ev2 also has move and copy
>>> operations that do attempt to resuse alter. I'm not clear why they are
>>> different. Why is add different from move/copy?
> Combinatorics.
> It is striking a balance between atomicity, and combinatoric growth.
> The API doesn't have to be "pure"... it needs to work.
> (iow, we can skip the Second System Syndrome and get stuff done,
> rather than perfect)
> I don't think it poses a serious problem. But yeah... if it does, then
> we'd want to expand move/copy with the variants.

A node that has been moved and is going to be altered is in the "wrong"
state between the move and the alter. The old node at the new location
doesn't necessarily have the correct contents for that node. In working
copy terms the moved nodes need to marked status=incomplete between move
and alter. This applies to individual files and whole directory trees.
The incomplete status gets cleared as the nodes are altered or when the
drive is complete. Ev1 doesn't have incomplete files so having
incomplete files is a new complication in Ev2.

>>> move_here_file(src_path, dst_path, properties, content, replaces_rev)
>>> move_here_dir(src_path, dst_path, properties, children, replaces_rev)
>>> copy_file(src_path, src_rev, dst_path, properties, content, replaces_rev)
>>> copy_dir(src_path, src_rev, dst_path, properties, children, replaces_rev)
> Don't forget the symlink variants!

Symlinks and files are easy, it's directories that are the problem: the
whole tree is incomplete between move and alter. It's not sensible to
attempt to transfer all the tree alterations as part of the directory
move, that would be an unbounded amount of data. We are just going to
have to handle this incomplete tree state. That means there is little
point introducing an atomic file/symlink move since we will still have
to handle non-atomic file moves as children of a moved directory.

It might be useful for Ev2 to have a subtree-complete operation. Nodes
in the destination tree that do not get explictly altered remain
incomplete until the drive is over. A subtree-complete operation would
allow them to be complete earlier.

I'm still unsure of the ordering rules. The 3 node depth swap

   A/B/C_at_N moved to A
   A/B_at_N moved to A/B
   A_at_N moved to A/B/C

appears to lead to:

   alter_dir ., children=A # is this needed?
   move_away A/B/C, A
   move_away A/B, A/B,
   move_away A, A/B/C
   move here A/B/C, A, replaces_rev=-1
   alter_dir A, children=B
   move_here A/B, A/B, replaces_rev=-1
   alter_dir A/B, children=C # is this needed?
   move_here A, A/B/C, replaces_rev=-1
   alter_dir A/B/C, children=

or since you don't appear to want to split move into away/here perhaps

   alter_dir ., children=A # is this needed?
   move here A/B/C, A,
   alter_dir A, children=B
   move_here A/B, A/B,
   alter_dir A/B, children=C # is this needed?
   move_here A, A/B/C,
   alter_dir A/B/C, children=

I don't know if Ev2 requires alter_dir on a directory that is having a
child replaced. Does a child replace constitute an edit of a parent
directory? The alter_dir calls for A and A/B/C are necessary because
the list of children is changing.

If I split move into away/here then this rule:

 * Example: mv A_at_N to B; mv C_at_M to A. The second move cannot be marked as
 * a "replacing" move since it is not replacing A. The node at A was moved
 * away. The second operation is simply moving C to the now-empty path
 * known as A.

would mean that replaces_rev is not set. It's not so clear how we apply
that rule if we don't split move. I suppose it should be the same as
the split case so none of the moves set replaces_rev?

Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*
Received on 2013-09-10 12:29:00 CEST

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.