diff --git a/cloudkitty/orchestrator.py b/cloudkitty/orchestrator.py index 87391411..6b2e4328 100644 --- a/cloudkitty/orchestrator.py +++ b/cloudkitty/orchestrator.py @@ -614,13 +614,17 @@ class CloudKittyProcessor(cotyledon.Service): lock_name, lock = get_lock( self.coord, self.generate_lock_base_name(tenant_id)) - LOG.debug('[Worker: {w}] Trying to acquire lock "{lock_name}".' - .format(w=self._worker_id, lock_name=lock_name)) + LOG.debug('[Worker: {w}] Trying to acquire lock "{lock_name}" for ' + 'scope ID {scope_id}.'.format(w=self._worker_id, + lock_name=lock_name, + scope_id=tenant_id)) lock_acquired = lock.acquire(blocking=False) if lock_acquired: - LOG.debug('[Worker: {w}] Acquired lock "{lock_name}".'.format( - w=self._worker_id, lock_name=lock_name)) + LOG.debug('[Worker: {w}] Acquired lock "{lock_name}" for ' + 'scope ID {scope_id}.'.format(w=self._worker_id, + lock_name=lock_name, + scope_id=tenant_id)) try: self.process_scope(tenant_id) @@ -702,9 +706,10 @@ class CloudKittyReprocessor(CloudKittyProcessor): self._worker_id, len(self.tenants)) def generate_lock_base_name(self, scope): - return "%s-id=%s-start=%s-end=%s-current=%s" % ( - self.worker_class, scope.identifier, scope.start_reprocess_time, - scope.end_reprocess_time, scope.current_reprocess_time) + return "%s-id=%s-start=%s-end=%s" % (self.worker_class, + scope.identifier, + scope.start_reprocess_time, + scope.end_reprocess_time) class CloudKittyServiceManager(cotyledon.ServiceManager): diff --git a/cloudkitty/tests/test_orchestrator.py b/cloudkitty/tests/test_orchestrator.py index 6e28024c..ba46c06c 100644 --- a/cloudkitty/tests/test_orchestrator.py +++ b/cloudkitty/tests/test_orchestrator.py @@ -623,10 +623,9 @@ class CloudKittyReprocessorTest(tests.TestCase): expected_lock_name = "-id=scope_identifier-" \ - "start=%s-end=%s-current=%s" % ( + "start=%s-end=%s" % ( scope_mock.start_reprocess_time, - scope_mock.end_reprocess_time, - scope_mock.current_reprocess_time) + scope_mock.end_reprocess_time) self.assertEqual(expected_lock_name, return_generate_lock_name) diff --git a/releasenotes/notes/reprocessing-concurrency-issues-2a71f4d86a93c507.yaml b/releasenotes/notes/reprocessing-concurrency-issues-2a71f4d86a93c507.yaml new file mode 100644 index 00000000..6c902fb8 --- /dev/null +++ b/releasenotes/notes/reprocessing-concurrency-issues-2a71f4d86a93c507.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixed concurrency issues during reprocessing tasks.