[egenix-users] Products.mxODBCZopeDA.ZopeDA.ReplayTransaction question

M.-A. Lemburg mal at egenix.com
Mon Aug 10 20:54:08 CEST 2009


Mathias Gibbens wrote:
> Hi list,
> 
>   I have a long running program that is occasionally getting this error:
> 
>   ReplayTransaction: OperationalError on
> <Products.mxODBCZopeDA.ZopeDA.DatabaseConnection "DSN=DBITS" thread
> 40041360/40041360 at 0x12544eac>: ('HYT00', 2006,
> '[unixODBC][MySQL][ODBC 3.51 Driver][mysqld-5.0.22-standard]MySQL server
> has gone away', 6113)
> 
>   When I recall the method that connects to MySQL, it returns normally.
> I looked at the documentation for the ReplayTransaction exception:
> 
> '5.2.2 Class "Products.mxODBCZopeDA.ZopeDA.ReplayTransaction" 
> Replay the current transaction after having rolled back any changes. 
> 
> Raising this exception will cause Zope to retry the complete
> transaction. This can be useful in case a database connection was lost.'
> 
>   However, I'm not sure from the short description exactly what happens
> when the exception is thrown. Does A) Zope automatically reconnect to
> MySQL, and only raise this exception so I know that Zope had to
> reconnect to MySQL, or B) is this exception thrown so I know that I need
> to actually do something about the dropped connection? To boil it down,
> can I just catch this exception, and continue in my program knowing that
> the database has been successfully updated, or do I have to do something
> in addition to make sure the changes have been committed?
> 
>   (Just so it's out there, I can't increase the MySQL server timeout.)

If the Zope DA finds a broken connection, it will reconnect and
then raise the above Zope exception in order to have the
Zope transaction/request machinery replay the current transaction.

Zope will allow for such replays to happen 2 or 3 times (IIRC)
before it returns an error to the user.

Since databases roll back the transaction on connection loss,
this kind of setup will significantly increase the availability
of the Zope system even during temporary database connection
problems.

If you wrap a Zope DA connection yourself, you have to reraise
the exception, so that Zope can process it.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Aug 10 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the egenix-users mailing list