exc_filters: fix deadlock detection for MariaDB/Galera cluster

MariasDB/Galera cluster server produces an error like:

(1213, u'Deadlock: wsrep aborted transaction')

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

Change-Id: Ifb4a81d50e490e734e12986e51efd6bd3c339c31
Signed-off-by: Pierre-Samuel Le Stang <pierre-samuel.le-stang@corp.ovh.com>
This commit is contained in:
Pierre-Samuel Le Stang 2019-02-08 16:46:21 +01:00
parent 8c60cc1135
commit ae227eb3b9
2 changed files with 8 additions and 0 deletions

View File

@ -63,6 +63,8 @@ def filters(dbname, exception_type, regex):
@filters("mysql", sqla_exc.InternalError, r"^.*\b1213\b.*Deadlock found.*")
@filters("mysql", sqla_exc.InternalError,
r"^.*\b1213\b.*detected deadlock/conflict.*")
@filters("mysql", sqla_exc.InternalError,
r"^.*\b1213\b.*Deadlock: wsrep aborted.*")
@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

@ -995,6 +995,12 @@ class TestDeadlock(TestsExceptionFilter):
orig_exception_cls=self.InternalError
)
self._run_deadlock_detect_test(
"mysql",
"(1213, 'Deadlock: wsrep aborted transaction')",
orig_exception_cls=self.InternalError
)
def test_mysql_pymysql_galera_deadlock(self):
self._run_deadlock_detect_test(
"mysql",