diff options
author | Roman Podoliaka <rpodolyaka@mirantis.com> | 2014-11-19 18:48:24 +0200 |
---|---|---|
committer | Roman Podoliaka <rpodolyaka@mirantis.com> | 2014-11-19 19:46:04 +0200 |
commit | 2269848495d66ebaceb7c643888d715b9117390c (patch) | |
tree | d202ad45b6f5a8584efb4bc5e890dd7663046b7b | |
parent | 027bdcb303e9c2327aa86ae1f504dd960a43801c (diff) | |
download | oslo-db-2269848495d66ebaceb7c643888d715b9117390c.tar.gz |
Handle Galera deadlock on SELECT FOR UPDATE
Using nova-api in the wild shows that we've got an additional
exception, that must be treated like a deadlock, so that we
can handle this error properly and retry the transaction.
Closes-Bug: #1394298
Change-Id: If75f2b5984979fe55ad04ccec8713989307c56ae
-rw-r--r-- | oslo/db/sqlalchemy/exc_filters.py | 2 | ||||
-rw-r--r-- | tests/sqlalchemy/test_exc_filters.py | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/oslo/db/sqlalchemy/exc_filters.py b/oslo/db/sqlalchemy/exc_filters.py index b3da401..ff6118e 100644 --- a/oslo/db/sqlalchemy/exc_filters.py +++ b/oslo/db/sqlalchemy/exc_filters.py @@ -58,6 +58,8 @@ def filters(dbname, exception_type, regex): # as well as sqlalchemy.exc.DBAPIError, as SQLAlchemy will reraise it # as this until issue #3075 is fixed. @filters("mysql", sqla_exc.OperationalError, r"^.*\b1213\b.*Deadlock found.*") +@filters("mysql", sqla_exc.OperationalError, + r"^.*\b1205\b.*Lock wait timeout exceeded.*") @filters("mysql", sqla_exc.InternalError, r"^.*\b1213\b.*Deadlock found.*") @filters("postgresql", sqla_exc.OperationalError, r"^.*deadlock detected.*") @filters("postgresql", sqla_exc.DBAPIError, r"^.*deadlock detected.*") diff --git a/tests/sqlalchemy/test_exc_filters.py b/tests/sqlalchemy/test_exc_filters.py index cb3d7ef..34dd991 100644 --- a/tests/sqlalchemy/test_exc_filters.py +++ b/tests/sqlalchemy/test_exc_filters.py @@ -491,6 +491,13 @@ class TestDeadlock(TestsExceptionFilter): "transaction')" ) + def test_mysql_mysqldb_galera_deadlock(self): + self._run_deadlock_detect_test( + "mysql", + "(1205, 'Lock wait timeout exceeded; " + "try restarting transaction')" + ) + def test_mysql_mysqlconnector_deadlock(self): self._run_deadlock_detect_test( "mysql", |