[Merge] Two Phase Locking

Martin Pool mbp at canonical.com
Sun Jul 9 13:25:38 BST 2006


On  7 Jul 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
> Martin Pool wrote:
> > I think I can give a better explanation for that.  We want locks to be
> > taken in a consistent order to avoid deadlocks.  We have a layered
> > structure, so we need to specify the ordering between layers, and also
> > between lockable objects on the same layer.  In general it's better to
> > lock from the bottom up.  (OK, that's not much better...)
> 
> Well, other before self I would consider to be bottom up.

Oh, right - yes, I meant that the order you chose is fine, but thinking
of it as "lower before higher" may help in more cases than "other before
self".

> I agree with all of your points. And I'm fine with moving both of them.
> But where do you want to move it to. Because both
> 'workingtree_implementations/test_workingtree.py' and
> branch_implementations/test_branch.py
> depend on it.
> 
> I think we have a small problem that our test utilities are mixed in
> with our test cases. I went ahead and created a new file
> bzrlib/tests/LockHelpers.py (in the vein of stub_server.py).
> 
> I don't usually use CamelCase, but TestUtil and a few others use it, and
> it makes it more obvious what files are tests, and what files are not.
> (treeshape.py really doesn't stand out if you are looking for helper
> functions to write your tests).
> 
> Would we want to create a new subdir, and put testing facilities there?
> Then we could also streamline our files a little bit more. And have a
> TestCaseInTempDir.py rather than everything in one file.
> 
> Are you happy enough with tests/LockHelpers.py that I can merge it? Or
> do you want to me to hold off?

tests/lock_helpers.py would be OK with me - I think CamelCase came in a
file copied from somewhere else and I don't like the inconsistency.

-- 
Martin




More information about the bazaar mailing list