exc_filters: fix deadlock detection for percona xtradb cluster

percona xtradb cluster server produces an error like:

(1213, u'WSREP detected deadlock/conflict and aborted the transaction.
         Try restarting the transaction')

which is currently not detected properly and, thus, not retried.

Closes-Bug: #1648818

Change-Id: Ic43cb0e0946506a4b7ce9f94ee9eba5e025ed3d5
This commit is contained in:
Roman Podoliaka 2016-12-09 15:44:42 +02:00
parent 6bc62b047b
commit 7c8f0f48bf
2 changed files with 10 additions and 0 deletions

View File

@ -62,6 +62,8 @@ def filters(dbname, exception_type, regex):
@filters("mysql", sqla_exc.DatabaseError,
r"^.*\b1205\b.*Lock wait timeout exceeded.*")
@filters("mysql", sqla_exc.InternalError, r"^.*\b1213\b.*Deadlock found.*")
@filters("mysql", sqla_exc.InternalError,
r"^.*\b1213\b.*detected deadlock/conflict.*")
@filters("postgresql", sqla_exc.OperationalError, r"^.*deadlock detected.*")
@filters("postgresql", sqla_exc.DBAPIError, r"^.*deadlock detected.*")
@filters("ibm_db_sa", sqla_exc.DBAPIError, r"^.*SQL0911N.*")

View File

@ -938,6 +938,14 @@ class TestDeadlock(TestsExceptionFilter):
"transaction')"
)
def test_mysql_pymysql_wsrep_deadlock(self):
self._run_deadlock_detect_test(
"mysql",
"(1213, 'WSREP detected deadlock/conflict and aborted the "
"transaction. Try restarting the transaction')",
orig_exception_cls=self.InternalError
)
def test_mysql_pymysql_galera_deadlock(self):
self._run_deadlock_detect_test(
"mysql",