[ZODB-Dev] Commit or lock object accross transactions

Christian Reis kiko at async.com.br
Wed Jul 16 13:09:02 EDT 2003


On Wed, Jul 16, 2003 at 04:02:54PM +0200, Roché Compaan wrote:
> How does one ensure that modifications to an object stored in ZODB is
> immediately visible to all transactions on all ZEO clients or is it
> easier to lock that object so that other transactions cannot modify that
> object.

To make modifications `visible' to all transactions, you need to commit
the change and have all other transactions invalidate their local caches
(calling something like sync(), though I think you can be finer-grained
than that).

I'd really like to know how you'd `lock' the object through the ZODB.
Sure, if it's in-process, you can use a variable lock or something more
elaborate; however, between processes (and between separate process
spaces, as multiple clients would configure), I don't think there *is* a
locking primitive in the ZODB.

> I don't want to call get_transaction().commit() after I make
> modifications to the object because this will commit other objects in
> the same transaction.

You could open a separate connection just to modify that object. We have
the same sort of problem in our application (generating user-visible IDs
for certain objects), though I haven't thought of a way to solve it yet.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL



More information about the ZODB-Dev mailing list