Add debug log to indicate when external lock is taken

In a case when a number of threads are concurrently accessing a
resource that has a external lock there is no indication when
one of the threads has taken the external lock.

This patch adds in a debug log to try and add some clarity.

Change-Id: Ibd7cfd3b39370b1a54f2ab50c75c6b92a876ae1a
This commit is contained in:
Gary Kotton 2017-07-26 17:52:47 +03:00
parent 88583edbb4
commit 9b3c8f34a9
1 changed files with 3 additions and 0 deletions

View File

@ -214,6 +214,9 @@ def lock(name, lock_file_prefix=None, external=False, lock_path=None,
if external and not CONF.oslo_concurrency.disable_process_locking:
ext_lock = external_lock(name, lock_file_prefix, lock_path)
ext_lock.acquire(delay=delay)
if do_log:
LOG.debug('Acquired external semaphore "%(lock)s"',
{'lock': name})
try:
yield ext_lock
finally: