On 2008-01-21 13:10, James Henstridge wrote: > On 21/01/2008, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: >> Thanks for the explanations. I was actually thinking of the >> connection between the TM and the RM (the database backend). >> The typical behavior of a TM is to cancel the ongoing >> two-phase commit transaction if an RM becomes unavailable. > > Stuart's use case is if the RM dies during the second phase of the > commit. It is an edge case, but then 2PC is all about edge cases :) > > If it happens before that point, then rolling back is appropriate. > > >> However, I can see your point. If the data stays on the >> database server and can be addressed via the XID, then a >> dropped connection wouldn't hurt all that much. >> Then again: how do you tell the database to forget about >> the data stored for an XID ? > > You ask for the transaction to be rolled back (e.g. "ROLLBACK PREPARED > xid" in PostgreSQL, and "XA ROLLBACK xid" for MySQL).
Sorry, I wasn't clear enough: If a connection fails and the transaction XID persists, how do you: * identify which XIDs are still pending (xa_recover) * tell the RM to drop all resources associacted with an XID (xa_forget) once the TM has reconnected. These APIs appear to be needed in order for the TM to be able to cleanup the RM after e.g. a lost connection. OTOH, perhaps just doing a rollback with the known XID and ignoring any errors would do the same without the need for extra APIs. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 21 2008) >>> 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 mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX 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 _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig