[Zope-CMF] Re: cmfuid

Dieter Maurer dieter at handshake.de
Mon Nov 22 14:26:46 EST 2004


Gregoire Weber wrote at 2004-11-22 17:31 +0100:
> ...
>Ok, I understand the issue in general. But in this case BTree-Length does 
>a read of 'value' and tries to write to the same 'value' attribute after
>having incremented it. No other variables are used to calculate the result 
>than 'value'. So shouldn't read conflicts be tracked by the write conflicts
>anyway?

Contrary to apparently general expectation, the problem lies *not*
with the (suppressed) "ReadConflictError"s but with the suppressed
"[Write]ConflictError"s.

"BTrees.Length" objects do not raise "ConflictError"s.
They have a so called application specific conflict resolution
that can combine the effect of any two conflicting transactions.

That is why a "CMFUid" implementation based on "BTrees.Length"
does not garantee id uniqueness.

Suppose transactions T1 and T2 concurrently request an id.
Suppose, the "BTrees.Length" object has value "id0".

Then both T1 and T2 will get "id0" as id value and
increment the length by "1". The conflict resolution
will prevent a "ConflictError" by incrementing the "Length" object
by 2. Thus, "id0" is used twice and "id0 + 1" is not used at all.

-- 
Dieter


More information about the Zope-CMF mailing list