From 87b298d348c2ea5fdd2c5672a8ebcdcf80236dc5 Mon Sep 17 00:00:00 2001 From: Duc Truong Date: Fri, 13 Apr 2018 18:50:08 +0000 Subject: [PATCH] Add deadlock retry decorator to gc_by_engine gc_by_engine calls _mark_failed. Because _mark_failed performs deletions, it can potentially deadlock. action_mark_failed also calls _mark_failed and is already protected using deadlock retry decorator. This change adds the deadlock retry decorator to gc_by_engine to prevent potential deadlocks. Change-Id: Iaf00a5cbb56cac9ab08d601e69924e8a7974486f --- senlin/db/sqlalchemy/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/senlin/db/sqlalchemy/api.py b/senlin/db/sqlalchemy/api.py index c38ec496d..5b578e1a0 100755 --- a/senlin/db/sqlalchemy/api.py +++ b/senlin/db/sqlalchemy/api.py @@ -1504,6 +1504,8 @@ def dummy_gc(engine_id): _release_cluster_lock(session, clock, action.id, 1) +@oslo_db_api.wrap_db_retry(max_retries=3, retry_on_deadlock=True, + retry_interval=0.5, inc_retry_interval=True) def gc_by_engine(engine_id): # Get all actions locked by an engine with session_for_write() as session: