[ZODB-Dev] Commit or lock object accross transactions

Roché Compaan roche at upfrontsystems.co.za
Wed Jul 16 18:20:44 EDT 2003


* Christian Reis <kiko at async.com.br> [2003-07-16 17:10]:
> 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).

The problem with this is that their might be legitimate transactions in
process on other clients.

> 
> 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 was just fishing to see if this was a possibility ;-)

> 
> > 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.

This sounds a lot like what we're trying to do. We have an object id
service that should dish out unique ids for objects. I thought one way
to maybe do it is to mount the object id service on another mountpoint
or storage similar to Zope's session storage but its just an idea at the
moment - I haven't delved into particulars.

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za



More information about the ZODB-Dev mailing list