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
This commit is contained in:
Duc Truong 2018-04-13 18:50:08 +00:00
parent 98d8cf30a3
commit 87b298d348
1 changed files with 2 additions and 0 deletions

View File

@ -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: