Browse Source

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>
Pierre-Samuel Le Stang 2 months ago
parent
commit
ae227eb3b9
2 changed files with 8 additions and 0 deletions
  1. 2
    0
      oslo_db/sqlalchemy/exc_filters.py
  2. 6
    0
      oslo_db/tests/sqlalchemy/test_exc_filters.py

+ 2
- 0
oslo_db/sqlalchemy/exc_filters.py View File

@@ -63,6 +63,8 @@ def filters(dbname, exception_type, regex):
63 63
 @filters("mysql", sqla_exc.InternalError, r"^.*\b1213\b.*Deadlock found.*")
64 64
 @filters("mysql", sqla_exc.InternalError,
65 65
          r"^.*\b1213\b.*detected deadlock/conflict.*")
66
+@filters("mysql", sqla_exc.InternalError,
67
+         r"^.*\b1213\b.*Deadlock: wsrep aborted.*")
66 68
 @filters("postgresql", sqla_exc.OperationalError, r"^.*deadlock detected.*")
67 69
 @filters("postgresql", sqla_exc.DBAPIError, r"^.*deadlock detected.*")
68 70
 @filters("ibm_db_sa", sqla_exc.DBAPIError, r"^.*SQL0911N.*")

+ 6
- 0
oslo_db/tests/sqlalchemy/test_exc_filters.py View File

@@ -995,6 +995,12 @@ class TestDeadlock(TestsExceptionFilter):
995 995
             orig_exception_cls=self.InternalError
996 996
         )
997 997
 
998
+        self._run_deadlock_detect_test(
999
+            "mysql",
1000
+            "(1213, 'Deadlock: wsrep aborted transaction')",
1001
+            orig_exception_cls=self.InternalError
1002
+        )
1003
+
998 1004
     def test_mysql_pymysql_galera_deadlock(self):
999 1005
         self._run_deadlock_detect_test(
1000 1006
             "mysql",

Loading…
Cancel
Save