summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Kibardin <gkibardin@mirantis.com>2017-01-30 11:47:50 +0300
committerGeorgy Kibardin <gkibardin@mirantis.com>2017-01-31 12:31:59 +0000
commitff04eb8394d81750608a95bedf6ab8cd5244d5e8 (patch)
treed2da4e24c790dbbf1d090a463fb76890f8afd804
parent542b8558f2129fd159a6fb661adad65c922676fa (diff)
Moving task cache update into task creation transaction
Doing this we avoid inclusion of task cache update statement into the next transaction which may cause different problems such as deadlock. In this particular case we've got the following deadlock: 1. DeleteIBPImagesTask makes UPDATE tasks SET cache.... 2. Response handler in receiver makes SELECT clusters FOR UPDATE 3. The code following DeleteIBPImagesTask makes SELECT clusters FOR UPDATE 4. Response handler performs SELECTS tasks FOR UPDATE Change-Id: Ic8e5f2386364421b0667f920499e031f587f726e Closes-Bug: #1653083
Notes
Notes (review): Code-Review+1: Alexander Kislitsky <akislitsky@mirantis.com> Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+2: Bulat Gaifullin <gaifullinbf@gmail.com> Code-Review+2: Aleksey Kasatkin <akasatkin@mirantis.com> Workflow+1: Bulat Gaifullin <gaifullinbf@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 07 Feb 2017 17:11:22 +0000 Reviewed-on: https://review.openstack.org/426675 Project: openstack/fuel-web Branch: refs/heads/master
-rw-r--r--nailgun/nailgun/task/task.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/nailgun/nailgun/task/task.py b/nailgun/nailgun/task/task.py
index f2d7db0..fec16a4 100644
--- a/nailgun/nailgun/task/task.py
+++ b/nailgun/nailgun/task/task.py
@@ -909,8 +909,9 @@ class DeleteIBPImagesTask(object):
909 def execute(cls, cluster, image_data): 909 def execute(cls, cluster, image_data):
910 task = Task(name=consts.TASK_NAMES.remove_images, cluster=cluster) 910 task = Task(name=consts.TASK_NAMES.remove_images, cluster=cluster)
911 db().add(task) 911 db().add(task)
912 message = cls.message(task, image_data)
912 db().commit() 913 db().commit()
913 rpc.cast('naily', cls.message(task, image_data)) 914 rpc.cast('naily', message)
914 915
915 916
916class StopDeploymentTask(object): 917class StopDeploymentTask(object):