[Zope-dev] Making a ZSQL.DA fully multi-threaded?

Dieter Maurer dieter at handshake.de
Fri Jul 23 14:08:50 EDT 2004


Brad Clements wrote at 2004-7-23 09:53 -0400:
>On 23 Jul 2004 at 10:58, Chris Withers wrote:
>
>> Dieter Maurer wrote:
>> > 
>> > All DA's I saw up to now, do a reconnect.
>> 
>> ZOracleDA didn't...
>> 
>> > But this is *WRONG" -- as part of a transaction may have been lost.
>> > After "reconnecting", they should raise an exception
>> > derived from "ConflictError" and let the complete request retry.
>
>Perhaps I don't understand, but how could their be a missing transaction?
>
>Zope starts, connects to database
>
>Zero or more transactions occur
>
>Zope is idle for some period of time

The bad sequence can look as follows:

 * Zope starts a request (and thereby a transaction)

 * The request sends a modifying request to a relational database

 * The connection is lost; the former modification is discarded
   as the database performs an automatic abort on connection close

 * The request sends another modifying requst to the database
   The DA detects the lost connection, reconnects and
   sends the SQL

 * The request ends and commits the transaction

In this case, you get only one of two changes in the database
while you should have got either none or both -- an inconsistency.

Raising an exception derived from "ConflictError" will
let "ZPublisher" abort the transaction and then restart
the complete request. You have a chance to get both changes...

-- 
Dieter


More information about the Zope-Dev mailing list