[ZODB-Dev] ZEO and commits

Antonio Beamud Montero antonio.beamud at linkend.com
Tue Oct 28 07:41:42 EST 2003


I have analize the code and some intersting questions arises:
When raises a ConflictException, the next traceback appears:

Traceback (most recent call last):
  File "./client1.py", line 34, in ?
    get_transaction().commit()
  File
"/usr/local/home/antonio/src/python/ZODB3-3.2c1/build/lib.linux-i686-2.3/ZODB/Transaction.py", line 233, in commit
    ncommitted += self._commit_objects(objects)
  File
"/usr/local/home/antonio/src/python/ZODB3-3.2c1/build/lib.linux-i686-2.3/ZODB/Transaction.py", line 348, in _commit_objects
    jar.commit(o, self)
  File "/usr/lib/python2.3/site-packages/ZODB/Connection.py", line 332,
in commit
    raise ConflictError(object=object)
ZODB.POSException.ConflictError: database conflict error (oid
0000000000000000, class Persistence.PersistentMapping)

This is the code in  Connection.py:
	...
       elif object._p_changed:
            if invalid(oid):
                print object
                print dir(object)
                print getattr(object, "_p_resolveConflict", None)
                resolve = getattr(object, "_p_resolveConflict", None)
                if resolve is None:
                    raise ConflictError(object=object)
            self._modified.append(oid)
                                                                                                                     The object hasn't a _p_resolveConflict because is the root object, it only has methods like dictionary has and not like Register object has...

I'm very confused...

El mar, 28-10-2003 a las 11:34, Antonio Beamud Montero escribió:
> Well, _p_resolveConflict doesn't works for me:
> I have written some example code:
> Execute in order -> client1.py, (1 second) client2.py
> 
> To execute ZEO:
> python /usr/lib/python2.3/site-packages/ZEO/start.py -p 60007
> /tmp/foo.dat
> 
> Am I doing something wrong?
> 
> Thanks
> 
> El lun, 27-10-2003 a las 19:26, Stefan H. Holek escribió:
> > A state argument basically contains the __dict__ of the object experiencing 
> > a conflict.
> > 
> > oldState ..... the state of when your transaction started
> > savedState ... the state another thread persisted since
> >                your transaction started.
> > newState ..... the state your transaction attempted to persist
> >                when it triggered the conflict error.
> > 
> > oldState is here so you have a clean state to start from, savedState and 
> > newState are the ones competing for "finalState".
> > 
> > Your resolution code may now look something like:
> > 
> >   def _p_resolveConflict(self, oldState, savedState, newState):
> >     intermediateState = merge(oldState, savedState)
> >     finalState = merge(intermediateState, newState)
> >     return finalState
> > 
> > If you cannot resolve the conflict, raise a ConflictError.
> > 
> > hth,
> > Stefan
> > 
> > 
> > 
> > --On Montag, 27. Oktober 2003 10:39 +0100 Antonio Beamud Montero 
> > <antonio.beamud at linkend.com> wrote:
> > 
> > > I suppose I need to use the _p_resolveConflict() method but where I can
> > > see more examples? The documentation is very short...
> > 
> > 
> > --
> > The time has come to start talking about whether the emperor is as well
> > dressed as we are supposed to think he is.               /Pete McBreen/
-- 
Antonio Beamud Montero <antonio.beamud at linkend.com>




More information about the ZODB-Dev mailing list