[ZODB-Dev] Commit or lock object accross transactions

Shane Hathaway shane at zope.com
Mon Jul 28 18:42:25 EDT 2003


Roché Compaan wrote:
> * Shane Hathaway <shane at zope.com> [2003-07-28 20:56]:
>>Well, seriously, calling self._p_jar.new_oid() ought to work pretty 
>>well.  You'll only exhaust the OID space if you make 1 billion IDs per 
>>second consistently for the next 500 years. ;-)
> 
> I am curious as to why actually this guarantees unique ids. I used
> exactly the same thread locking that is seen in new_oid and I still got
> duplicates. _p_jar.new_oid won't work for our app because I need
> sequential ids per meta_type - I'm not too worried about orphaned ids
> though.

It works because OIDs are managed centrally by the ZEO server and fall 
outside transaction scope.  It's also reasonably fast because clients 
request blocks of OIDs rather than single OIDs.

The RDBMS parallel is a sequence, but an important difference is that 
ZEO lets you have only one such sequence.  Maybe ZEO should let you have 
an arbitrary number of integer sequences (keyed by OID, perhaps).

Shane




More information about the ZODB-Dev mailing list