[Zope-DB] DA's violating transactional assertions

M.-A. Lemburg mal@lemburg.com
Tue, 28 Jan 2003 17:06:47 +0100


M.-A. Lemburg wrote:
> Dieter Maurer wrote:
> 
>> Federico Di Gregorio wrote at 2003-1-24 10:27 +0100:
>>  > Il ven, 2003-01-24 alle 04:12, Robert Kellock ha scritto:
>>  > > Which ones?
>>  >  > ZpsycopgDA for sure (right Dieter? :) and probably ZOracleDA 
>> (from which
>>  > ZPsycopgDA was derived), ZPoPyDA and maybe even the mysql adapter 
>> (but i
>>  > can be wrong here.)
>>  >  > i completely agree with Dieter's analisys and i'll try to fix the
>>  > problem in the 1.1 series. the problem is: does zope provides such a
>>  > "special exception"?
>> The "retry" logic is implemented in 
>> "Zope/__init__.py:zpublisher_exception_hook".
>> As it is, it retries on any subclass of 
>> "ZODB.POSException.ConflictError".
>>
>> Of course, when it really were necessary, it could be extended.
>> But, the current case would not make this necessary.
>> The DA could simply derive an appropriate exception
>> from "ZODB.POSException.ConflictError" and use that
>> for its transient errors.
>>
>> We may get cleaner code across DA's when we define a standard
>> DATransientError. It should clearly state, which DA instance (path)
>> got the problem and what was the original exception (which
>> we converted into a "DATransientError").
>>
>> On alternative to such an information rich exception would
>> be to log the original exception (not a bad idea anyway).
> 
> 
> Then let's do both: log the event and raise a ConflictError
> subclass.
> 
> Does Zope have means to prevent an endless loop here ? E.g.
> in case the OperationalError raised by the database was not
> really caused by a lost connection.

FWIW, trial & error suggests that Zope accepts this exception at
most once. The second time around it passes the exception back
to the user.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/