[ZODB-Dev] tid vs. serial

Jim Fulton jim at zope.com
Mon Oct 18 09:51:46 EDT 2010


On Mon, Oct 18, 2010 at 8:53 AM, Vincent Pelletier <vincent at nexedi.com> wrote:
> Hi.
>
> During my presentation of NEO at DZUG, Cristian Theune told me that I might be
> confusing tids and serials. And indeed, I could not define the difference
> between them.

I wonder what he meant.

> Then I thought about it, and I came to the idea that one of them is only valid
> during some time (probably only during 2PC) while the other is persistently
> valid.

In early versions of ZODB, serials and tids weren't known to be the
same, which is why we have _p_serial rather than _p_tid.  With
experience, we've found that they really are the same.

> This means that having just the persistent one is not incorrect, but might add
> bigger constraints on transaction commit order (transaction number cannot
> decrease, etc), explaining why we don't see any "persistent problem" (data
> corruption, etc) when misused.

Serial and tid are the same and tids must be monotonically increasing.

> Is this right ?

Probably not. I'm not sure what you were saying, but if it was based
on the premise that tids and serials are different, then it's
wrong. :)

> If there is any documentation on this ?

The doc strings in ZODB/interfaces.py mention in many places that
serial is an alias for tid.

Jim

--
Jim Fulton


More information about the ZODB-Dev mailing list