Commit 1a0ea1b2 authored by Kapil Thangavelu's avatar Kapil Thangavelu

Changes

  1. Fixes a bug in the TM whereby tpc_abort was ignored. this
     was the likely cause of external transaction manager's never
     recieving a commit or abort statement and hanging because
     they could never register again for a transaction.

  2. Works around a bug in Zope's transaction machinery. This
     bug is a corner case. it would cause loss of data integrity
     if a external transaction manager were involved in a
     zope transaction that involved a subtransaction commit, in
     which the overall transaction was aborted.
parent f2be2bb6
......@@ -34,11 +34,12 @@ class TM:
try:
get_transaction().register(Surrogate(self))
self._begin()
self._registered=1
self._registered = 1
self._finalize = 0
except: pass
def tpc_begin(self, *ignored): pass
commit=tpc_abort=tpc_begin
commit=tpc_begin
def _finish(self):
self.db.commit()
......@@ -46,14 +47,21 @@ class TM:
def _abort(self):
self.db.rollback()
def tpc_vote(self, *ignored):
self._finalize = 1
def tpc_finish(self, *ignored):
try: self._finish()
finally: self._registered=0
if self._finalize:
try: self._finish()
finally: self._registered=0
def abort(self, *ignored):
try: self._abort()
finally: self._registered=0
tpc_abort = abort
class Surrogate:
def __init__(self, db):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment