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
This commit is contained in:
Mike Bayer 2016-11-21 09:19:18 -05:00
parent accd272d15
commit 34f9a3ac7a
2 changed files with 9 additions and 0 deletions

View File

@ -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.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("postgresql", sqla_exc.OperationalError, r".*could not connect to server") # noqa
@filters("ibm_db_sa", sqla_exc.OperationalError, r".*(?:30081)") @filters("ibm_db_sa", sqla_exc.OperationalError, r".*(?:30081)")
def _is_db_connection_error(operational_error, match, engine_name, def _is_db_connection_error(operational_error, match, engine_name,

View File

@ -1179,6 +1179,14 @@ class TestDBDisconnected(TestsExceptionFilter):
with self._fixture(dialect_name, exc_obj, 1): with self._fixture(dialect_name, exc_obj, 1):
self.assertEqual(1, self.engine.scalar(sqla.select([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): def test_mysql_ping_listener_disconnected(self):
for code in [2006, 2013, 2014, 2045, 2055]: for code in [2006, 2013, 2014, 2045, 2055]:
self._test_ping_listener_disconnected( self._test_ping_listener_disconnected(