summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-11-21 09:19:18 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2016-11-25 15:33:46 -0500
commitd94b7e3e3321f2dad7ab5861040b2d91f9036a5d (patch)
treebe99412a18db8a380453479c41dda36d01d9974e
parentd4000aa2c8f45da5526e9de4bdf2731ba1795d09 (diff)
downloadoslo-db-d94b7e3e3321f2dad7ab5861040b2d91f9036a5d.tar.gz
Support MariaDB error 19274.13.4
We're observing a MariaDB-specific error code "1927 connection was killed", which seems to indicate the condition where the client/server connectivity is still up but the mariadb server has been restarted. This error needs to be supported as one of the "disconnect" situations so that the ping handler knows to force a reconnect. Change-Id: I484237c28a83783689bb8484152476de33f20e3a References: https://bugs.launchpad.net/tripleo/+bug/1642944 (cherry picked from commit 34f9a3ac7a56883f8a2cd2a9a93bc42e5194bc1e)
-rw-r--r--oslo_db/sqlalchemy/exc_filters.py1
-rw-r--r--oslo_db/tests/sqlalchemy/test_exc_filters.py8
2 files changed, 9 insertions, 0 deletions
diff --git a/oslo_db/sqlalchemy/exc_filters.py b/oslo_db/sqlalchemy/exc_filters.py
index fb46440..b9b1d72 100644
--- a/oslo_db/sqlalchemy/exc_filters.py
+++ b/oslo_db/sqlalchemy/exc_filters.py
@@ -364,6 +364,7 @@ def _raise_operational_errors_directly_filter(operational_error,
@filters("mysql", sqla_exc.OperationalError, r".*\(.*(?:2002|2003|2006|2013|1047)") # noqa
+@filters("mysql", sqla_exc.InternalError, r".*\(.*(?:1927)") # noqa
@filters("postgresql", sqla_exc.OperationalError, r".*could not connect to server") # noqa
@filters("ibm_db_sa", sqla_exc.OperationalError, r".*(?:30081)")
def _is_db_connection_error(operational_error, match, engine_name,
diff --git a/oslo_db/tests/sqlalchemy/test_exc_filters.py b/oslo_db/tests/sqlalchemy/test_exc_filters.py
index 101b2eb..de9726a 100644
--- a/oslo_db/tests/sqlalchemy/test_exc_filters.py
+++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py
@@ -1094,6 +1094,14 @@ class TestDBDisconnected(TestsExceptionFilter):
with self._fixture(dialect_name, exc_obj, 1):
self.assertEqual(1, self.engine.scalar(sqla.select([1])))
+ def test_mariadb_error_1927(self):
+ for code in [1927]:
+ self._test_ping_listener_disconnected(
+ "mysql",
+ self.InternalError('%d Connection was killed' % code),
+ is_disconnect=False
+ )
+
def test_mysql_ping_listener_disconnected(self):
for code in [2006, 2013, 2014, 2045, 2055]:
self._test_ping_listener_disconnected(