[ZODB-Dev] Unique Object ID
Johan Dahlin
jdahlin at async.com.br
Wed Jun 4 21:49:35 EDT 2003
We've been running into a issue here while developing IndexedCatalog.
IndexedCatalog stores information about it's objects (which always are
inherited from a special class) in a OOBTree.
They are keyed by the id of the object. In the current invocation of
IndexedCatalog we have been using id() of the object (eg the memory
address) as the id of the object.
Recently we have found out that it's not very reliable, since it might
create conflicts if the same memory address is returned when creating
objects. So we need to find out a reliable way of creating a object id.
There are basically two options that I can think of:
1) use _p_oid
We must first store the object in a temporary location somewhere under
the root commit(1) pull it back and get the oid. I think this is really
bad for performance. Is it possible to get an _p_oid in another way? Or
store the object in a connection and not a root?
2) Using a counter, increase it for each object
I believe this can create problems regarding to multiple connections and
conflict errors. Create an object in connection A, create another one in
connection B, commit A, commit B. *boom*
Am I missing something, or is it another way of doing this?
Comments, suggestions highly appreciated.
--
Johan Dahlin <jdahlin at async.com.br>
Async Open Source
More information about the ZODB-Dev
mailing list