summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-12-14 12:41:16 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2016-12-14 12:44:32 -0500
commitc61d2d47bd39c31f1cd06faf497ffa85ae66cdd4 (patch)
tree406ab477eb1246fda744e241c6debdb3daa6f489
parentd7993bab9dce0efc4a31ee3d31bda0aef5cf6b09 (diff)
downloadoslo-db-c61d2d47bd39c31f1cd06faf497ffa85ae66cdd4.tar.gz
Support packet sequence wrong error
In I484237c28a83783689bb8484152476de33f20e3a, we observed MariaDB-specific error code 1927 as a new kind of disconnect situation. In some failure-mode testing we are also observing with PyMySQL that a stale connection, when it is attempted to be used for the initial ping, does not return any error code but instead trips up PyMySQL with packets sequence numbers (this is an internal value used by the MySQL client/server protocol to track messages). The connection is definitely not recoverable in this state so this also needs to be a disconnect situation so that the ping listener refreshes the connection pool. Change-Id: Iee1c4533e2457acc30e2046b63145c2502012c5f 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 9fb81c3..3040edc 100644
--- a/oslo_db/sqlalchemy/exc_filters.py
+++ b/oslo_db/sqlalchemy/exc_filters.py
@@ -387,6 +387,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("mysql", sqla_exc.InternalError, r".*Packet sequence number wrong") # 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 0894c3d..558cca8 100644
--- a/oslo_db/tests/sqlalchemy/test_exc_filters.py
+++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py
@@ -1195,6 +1195,14 @@ class TestDBDisconnected(TestsExceptionFilter):
is_disconnect=False
)
+ def test_packet_sequence_wrong_error(self):
+ self._test_ping_listener_disconnected(
+ "mysql",
+ self.InternalError(
+ 'Packet sequence number wrong - got 35 expected 1'),
+ is_disconnect=False
+ )
+
def test_mysql_ping_listener_disconnected(self):
for code in [2006, 2013, 2014, 2045, 2055]:
self._test_ping_listener_disconnected(