Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zzzeek committed Nov 21, 2016
1 parent accd272 commit 34f9a3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions oslo_db/sqlalchemy/exc_filters.py
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions oslo_db/tests/sqlalchemy/test_exc_filters.py
Expand Up @@ -1179,6 +1179,14 @@ def _test_ping_listener_disconnected(
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(
Expand Down

0 comments on commit 34f9a3a

Please sign in to comment.