[ZODB-Dev] BTree corrupted after conflict resolution
Jeremy Hylton
jeremy at zope.com
Wed Mar 3 20:08:20 EST 2004
On Wed, 2004-03-03 at 19:34, John Belmonte wrote:
> Dieter Maurer wrote:
> > During conflict resolution the state does not contain
> > the persistent subobjects themselves but only references.
> >
> > Therefore, your "__cmp__" cannot be used to compare
> > the persistent subobjects. Almost surely, the default
> > "__cmp__" is used which is, of course, wrong and
> > can lead to corruption.
>
> It seems you are right. If I change the key class to a second-class
> object, the problem goes away.
I'm glad we understand it, now. (Thanks, Dieter.)
> > Almost surely, we must add a further restriction for BTrees:
> > the keys must not be persistent objects.
>
> I think that would be an unreasonable restriction. If the server
> context can access the _p_conflictResolution method of a class, why not
> __cmp__, etc.?
_p_conflictResolution should really be a staticmethod, but it was
invented before Python had staticmethods. That is, the method is passed
three object states but it isn't supposed to access self. Furthermore,
it only sees a single object state, it does not have access to the state
of any other first-class persistent objects.
Perhaps we should define an __cmp__() method that raises an error on the
stub objects that conflict resolution provides.
Jeremy
More information about the ZODB-Dev
mailing list