[ZODB-Dev] How to avoid ConflictErrors in BTrees ?
Jim Fulton
jim at zope.com
Fri Feb 1 08:10:29 EST 2008
On Feb 1, 2008, at 6:03 AM, Tarek Ziadé 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 there a way to avoid these conflicts in BTree ?
Your best bet is to look at your application to see if you can avoid
the hot spot in the first place. For example, your test script creates
threads that allocate overlapping ids, guaranteeing conflicts. This is
probably a bug in your test script. 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).
I have plans to redo conflict resolution to:
- do resolution on the client, where the software is,
- make it more flexible,
- allow conflict-resolution on multiple objects
but I don't know when that will happen. In any case, there are often
better application-specific approaches to avoid the conflicts in the
first place.
Jim
--
Jim Fulton
Zope Corporation
More information about the ZODB-Dev
mailing list