From 77357d3ffe4c7ddef385937c1ed0502fa9f60aea Mon Sep 17 00:00:00 2001 From: Doug Wiegley Date: Sat, 16 Feb 2019 20:36:08 -0700 Subject: [PATCH] Bump lower version of oslo.db to one that includes jitter argument Change-Id: I2f85c495a47b740823e19c60a3ae3ac5762d0297 --- lower-constraints.txt | 2 +- neutron_lib/db/api.py | 27 +++++++-------------------- requirements.txt | 2 +- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index af92a55bb..43c907d18 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -41,7 +41,7 @@ os-traits==0.9.0 oslo.concurrency==3.26.0 oslo.config==5.2.0 oslo.context==2.19.2 -oslo.db==4.27.0 +oslo.db==4.37.0 oslo.i18n==3.15.3 oslo.log==3.36.0 oslo.messaging==5.29.0 diff --git a/neutron_lib/db/api.py b/neutron_lib/db/api.py index 9374b12ab..d88b67ef8 100644 --- a/neutron_lib/db/api.py +++ b/neutron_lib/db/api.py @@ -12,7 +12,6 @@ import contextlib import copy -import inspect import weakref from oslo_concurrency import lockutils @@ -148,25 +147,13 @@ def _copy_if_lds(item): return copy.deepcopy(item) if isinstance(item, (list, dict, set)) else item -# Do retries with some randomness in the backoff, if the version -# of oslo.db supports it. -# TODO(dougwig): remove this gross if/else when lower constraints -# on oslo.db is >= 4.37.0. -if 'jitter' in inspect.getargspec(oslo_db_api.wrap_db_retry.__init__).args: - _retry_db_errors = oslo_db_api.wrap_db_retry( - max_retries=MAX_RETRIES, - retry_interval=0.5, - inc_retry_interval=True, - exception_checker=is_retriable, - jitter=True - ) -else: - _retry_db_errors = oslo_db_api.wrap_db_retry( - max_retries=MAX_RETRIES, - retry_interval=0.5, - inc_retry_interval=True, - exception_checker=is_retriable, - ) +_retry_db_errors = oslo_db_api.wrap_db_retry( + max_retries=MAX_RETRIES, + retry_interval=0.5, + inc_retry_interval=True, + exception_checker=is_retriable, + jitter=True +) def retry_db_errors(f): diff --git a/requirements.txt b/requirements.txt index 8e09ff9e6..75aa70d64 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ stevedore>=1.20.0 # Apache-2.0 oslo.concurrency>=3.26.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0 oslo.context>=2.19.2 # Apache-2.0 -oslo.db>=4.27.0 # Apache-2.0 +oslo.db>=4.37.0 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 oslo.messaging>=5.29.0 # Apache-2.0