summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-12-14 12:41:16 -0500
committerRaoul Scarazzini <rscarazz@redhat.com>2016-12-15 11:42:09 +0100
commit6843da73a75d14e912a03bab2b203feda2051ada (patch)
tree2d4488dfcfbf04e8d247b745a4719dd5b8bfd046
parentd94b7e3e3321f2dad7ab5861040b2d91f9036a5d (diff)
downloadoslo-db-6843da73a75d14e912a03bab2b203feda2051ada.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 (cherry picked from commit c61d2d47bd39c31f1cd06faf497ffa85ae66cdd4)
-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 b9b1d72..ab1781b 100644
--- a/oslo_db/sqlalchemy/exc_filters.py
+++ b/oslo_db/sqlalchemy/exc_filters.py
@@ -365,6 +365,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 de9726a..fb6703f 100644
--- a/oslo_db/tests/sqlalchemy/test_exc_filters.py
+++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py
@@ -1102,6 +1102,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(