]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
two_phase_recover, COMMIT PREPARED in transaction
authorTony Locke <tlocke@tlocke.org.uk>
Sat, 26 Jul 2014 19:10:36 +0000 (20:10 +0100)
committerTony Locke <tlocke@tlocke.org.uk>
Sat, 2 Aug 2014 14:29:36 +0000 (15:29 +0100)
In test/engine/test_transaction/test_two_phase_recover(), a COMMIT
PREPARED is issued while in a transaction. This causes an error, and
a prepared transaction is left hanging around which causes
the subsequent test to hang. I've altered the test to execute the
offending query with autocommit=true, then when it gets to the COMMIT
PRPARED it can go ahead.

There's another complication for pg8000 because its tpc_recover() method
started a transaction if one wasn't already in progress. I've decided
that this is incorrect behaviour and so from pg8000-1.9.13 this method
never starts or stops a transaction.

test/engine/test_transaction.py
test/requirements.py

index f9744444d296943f5e27305c1b4bc73cbd9bef43..8a530364221d75cb2809a7f5649856f0a08ff21c 100644 (file)
@@ -347,9 +347,10 @@ class TransactionTest(fixtures.TestBase):
         connection.invalidate()
 
         connection2 = testing.db.connect()
-        eq_(connection2.execute(select([users.c.user_id]).
-            order_by(users.c.user_id)).fetchall(),
-            [])
+        eq_(
+            connection2.execution_options(autocommit=True).
+            execute(select([users.c.user_id]).
+            order_by(users.c.user_id)).fetchall(), [])
         recoverables = connection2.recover_twophase()
         assert transaction.xid in recoverables
         connection2.commit_prepared(transaction.xid, recover=True)
index bf9b8f52632538585f827e58325e858acc333b32..7eeabef2b4892cd17745b1e0fdd18cea6a237a67 100644 (file)
@@ -363,7 +363,6 @@ class DefaultRequirements(SuiteRequirements):
                        'need separate XA implementation'),
             exclude('mysql', '<', (5, 0, 3),
                         'two-phase xact not supported by database'),
-            no_support("postgresql+pg8000", "not supported and/or hangs")
             ])
 
     @property