[Zope] ConflictError (ID-Counter for all Documents)

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 24 Jan 2002 12:45:08 +0000


On Thu, 24 Jan 2002 11:59:18 +0100, Thomas Guettler
<zopestoller@thomas-guettler.de> wrote:

>Catch the Exception, and retry it.

Dont catch it yourself. Zope is already doing this, and only shows the
client an error message if it still fails after 3 attempts.

>Use PCounter from ZODB/test/ConflictResolution.py

No, for two reasons:

That class makes a good counter, but it is no use if you want to use
the counter to generate unique ids. It works by allowing two
transactions to proceed simultaneously with the same count value, then
incrementing the count by two instead of one.

Secondly, it wouldnt help even if it did generate unique ids. You
would still get a conflict from the folder object.

The easiest solution is to use only one publisher thread. That means
no concurrency, no conflicts, but limited scalability.

You best solution is:

1. Use a BTreeFolder (download it from www.zope.org), which allows for
concurrent writes. It wont eliminate the need for retries, but it
should decrease the probability of a failure after the three retries
to an acceptable level.

2. Use a different method of generating ids, to avoid the problem
where two concurrent writes always generate the same id. The easiest
solution is random ids.



Toby Dickenson
tdickenson@geminidataloggers.com