[ZODB-Dev] ZEO and commits

Christian Robottom Reis kiko at async.com.br
Fri Oct 24 13:01:59 EDT 2003


On Fri, Oct 24, 2003 at 06:01:48PM +0200, Antonio Beamud Montero wrote:
> > If other clients update the original object, you have a conflict. 
> > When you call sync(), the current transaction is aborted, and any
> > conflicting changes are discarded. So calling sync() and *then*
> > modifying the object is what you need to do.
> 
> The sequence can be: get_transaction.commit()
>                      con.sync()
>                      <modify object
>                      get_transaction.commit()
> 
> This acts like a lock, no?

No, and there is no locking primitive in the ZODB -- concurrent writes
must resolve a conflict or fail.

Note that a sync() following a commit() is redundant, since a successful
commit() invalidates the cache anyway (IIRC).

> Need I to do a get_transaction.commit() or can I do a
> get_transaction.commit(1)?

Well, commit(1) won't help you here; however, the root of your problem
here seems that you are/will be running into conflicts, and no measure
of sync()ing will help you once you've reached a conflict.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331



More information about the ZODB-Dev mailing list