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-21 09:19:18 -0500
commit34f9a3ac7a56883f8a2cd2a9a93bc42e5194bc1e (patch)
tree9e1ba1dc7d2c3a1a39f6db2baa807f33a44372bd
parentaccd272d15a142054b4d7e6c6c23743730a09bb2 (diff)
downloadoslo-db-34f9a3ac7a56883f8a2cd2a9a93bc42e5194bc1e.tar.gz
Support MariaDB error 1927
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
-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 157dfd0..d3dd9b2 100644
--- a/oslo_db/sqlalchemy/exc_filters.py
+++ b/oslo_db/sqlalchemy/exc_filters.py
@@ -384,6 +384,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 8e62a77..293de15 100644
--- a/oslo_db/tests/sqlalchemy/test_exc_filters.py
+++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py
@@ -1179,6 +1179,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(