[ZODB-Dev] Commit or lock object accross transactions

Toby Dickenson tdickenson at geminidataloggers.com
Wed Jul 16 19:01:38 EDT 2003


On Wednesday 16 July 2003 17:49, Christian Reis wrote:
> On Wed, Jul 16, 2003 at 05:33:02PM +0100, Toby Dickenson wrote:
> > If you only need a small number of unique ids then there may be a cheeky
> > option..... the method for allocating ZODB OIDs has all of the
> > characteristics that you need. You could use an oid of a newly created
> > object as your unique id, or call the storage.new_oid method directly.
>
> Why only "a small number"?

There is a limited supply of 2^64 over the life of a storage. Im not sure what 
happens after that, but its bound to be bad.

I guess you are unlikely to hit that limit unless you need *huge* numbers of 
unique ids. Be careful not to expose yourself to a denial of service attack, 
if untrusted users can assign large numbers of unique ids.

Also note that the zeo server hands out oid is in batches of 100 to clients, 
then zeo clients can efficiently assign oids from that batch. All those other 
solutions that involve using two transactions will need two hits on the ZEO 
server - but this is 100 times more efficient.

> The problem I see here is that ZODB OIDs are global for *all* objects
> (of any type) in the database, which might not be what is required here
> (it certainly wouldn't work for me).

I dont follow that....?...

-- 
Toby Dickenson
http://www.geminidataloggers.com/people/tdickenson



More information about the ZODB-Dev mailing list