From 3e5a9612d180781d281fdae08f859bb399ded0d0 Mon Sep 17 00:00:00 2001 From: Roman Podoliaka Date: Thu, 7 Apr 2016 13:25:03 +0300 Subject: [PATCH] db: retry instance_info_cache_update() on deadlock If a Galera cluster is used in multi-writer mode it's possible, that instance_info_cache_update() will be executed concurrently on two different MySQL hosts for the very same row, which causes a deadlock exception for one of the callers due to how Galera works internally. This can affect operations like association or disassociation of floating IPs, which will fail, if instance_info_cache_update() does not handle deadlocks gracefully, i.e. is not retried. Closes-Bug: #1567336 Change-Id: Ib5abffd94d2480dfbcc8b6cca7b1c73ce39e7d10 --- nova/db/sqlalchemy/api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 91a462688..6ecba17ab 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -3005,6 +3005,7 @@ def instance_info_cache_get(context, instance_uuid): @require_context +@oslo_db_api.wrap_db_retry(max_retries=5, retry_on_deadlock=True) @pick_context_manager_writer def instance_info_cache_update(context, instance_uuid, values): """Update an instance info cache record in the table.