[ZODB-Dev] newbie ZEO first try. ConflictError.

James Bergstra james.bergstra at gmail.com
Thu Nov 26 16:08:39 EST 2009


On Thu, Nov 26, 2009 at 1:51 PM, tsmiller <tsmiller at gnixterhouse.com> wrote:
>
> Laurence,
> Thank you for your very quick reply.  I did as you suggested and now the
> ConflictError is now handled.  And that is a most excellent thing because
> now ConflictError is raised every time.  So it still seems to be confused.
> I am trying to figure out if I will be able to use ZEO in my application.
>
> Now my program reads:
>
> while True:
>        root[ "one" ] = time.asctime()
>        while True:
>                try:
>                        print "Try to commit transaction"
>                        transaction.commit()
>                        print "root is",  root
>                except POSException.ConflictError:
>                        print "we have a conflict"
>                        transaction.abort()
>                        time.sleep(.2)
>                else:
>                        break
>
>        time.sleep(10)
>

I have a related question about this code... in the inner loop tom is
calling abort() ; sleep(); commit().  Does that make sense?

I thought that abort() would revert the root to the database's version
of things, and discard any change that the client had tried to make.
So what does it mean to call commit() again immediately and why that
commit cause a conflict when the client hasn't actually changed
anything since abort() ?

James
-- 
http://www-etud.iro.umontreal.ca/~bergstrj


More information about the ZODB-Dev mailing list