Retry on DB deadlock when updating resource

Updating a row in the DB using UPDATE...WHERE... seems to be prone to
deadlocks. We already fixed added retries for updates of the Stack table
(bug 1578615); do the same with the Resource table.

Change-Id: I3928f1acc3c354711a27523215784a8cf8767581
Closes-Bug: #1732969
This commit is contained in:
Zane Bitter 2017-11-17 14:14:32 -05:00
parent 38f1975cf7
commit e919b723bc
1 changed files with 2 additions and 0 deletions

View File

@ -254,6 +254,8 @@ def _add_atomic_key_to_values(values, atomic_key):
values['atomic_key'] = atomic_key + 1
@oslo_db_api.wrap_db_retry(max_retries=3, retry_on_deadlock=True,
retry_interval=0.5, inc_retry_interval=True)
def resource_update(context, resource_id, values, atomic_key,
expected_engine_id=None):
session = context.session