[ZODB-Dev] storage API question

Jim Fulton jim@zope.com
Tue, 30 Apr 2002 09:07:17 -0400


Toby Dickenson wrote:
> 
> On Tuesday 30 Apr 2002 11:55 am, Jim Fulton wrote:
> 
> >> Does the storage also have to defend against 'store' being called from
> >> two threads concurrently for the same transaction?
> >
> >No. There is a separate transaction lock that prevents two threads
> >from committing at the same time.
> 
> Thanks Jim.
> 
> I have another question;
> 
> Some methods of the the storage interface have a paremeter 'serial', and
> others have 'tid'. Are these two names for exactly the same thing, or is
> there a subtle distinction that I am missing?

They are different, but most storages give them the same value.

tid is the transaction id, which is usually implemented as a 
binary string representation of a time stamp. The storage must
ensure that tids are unique. If two transactions occur close enough
together to have the same time stamp (due to limits in clock resolution),
one of the timestamps will be incremented by a few microseconds to make
the tid unique. 

serial is a unique id for an object revision. Most storages use the tid
for the transaction that committed the revision as the serial.

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
CTO                  (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org