[ZODB-Dev] How to avoid ConflictErrors in BTrees ?
Jim Fulton
jim at zope.com
Fri Feb 1 09:57:58 EST 2008
On Feb 1, 2008, at 9:49 AM, Tarek Ziadé wrote:
>
>
> Jim Fulton wrote:
>>
>> ...
>>> Since BTrees are written in C, I couldn't add my own conflict
>>> manager to try
>>> to merge buckets. (and this is
>>> way over my head)
>> That doesn't really matter, because conflict-resolution can only
>> operate on one object at a time.
>>
>
> Is the class I have shown to Andreas is the way to go for conflict
> resolution
> (beside the fact that it shouldn't occur with a better design) ?
I doubt it. I don't want to work that hard.
>
>
>
> Jim Fulton wrote:
>>
>> ..
>> A similar and common mistake is
>> to allocate keys sequentially. A better solution is to allocate keys
>> randomly (or sequentially within threads with random starting
>> points).
>>
>
> Is it possible to have some kind of thread-safe next_id() function ?
> like what some database systems provides
There are numerous examples of this. It isn't provided by ZODB because
this is an application issue. Look at the way ids are generated in
the Zope 3 intid utility and in the Zope 2 catalog.
Jim
--
Jim Fulton
Zope Corporation
More information about the ZODB-Dev
mailing list