Liron Ar has uploaded a new change for review. Change subject: core: avoid db deadlock and unneeded db updates for images ......................................................................
core: avoid db deadlock and unneeded db updates for images When adding vm from template (as part of pool or not), CreateSnapshotFromTemplateCommand is being executed and when the operation ends its end method is being called for each of the disks. In the end method there's an attempt to unlock the template image which causes to numerous issues: 1. There is no need to unlock it as after the add from template was changed to use shared lock on the template the template disks are not being locked at all. 2. There are attempts to update the template disks statuses to unlocked, as the updates aren't ordered and are executed for each added vm based on that template - db deadlocks occur. The fix which is introduced is to not update the image status if it's already in the desired status, which will reduce the updates count in general and will prevent possible db deadlocks in the provided scenarios. Change-Id: I26a09ce674cfefd59819f3edf95accab31f0e80e Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=915753 Signed-off-by: Liron Aravot <lara...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/00/21100/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java index 4725c13..433903d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java @@ -289,7 +289,7 @@ protected void setImageStatus(ImageStatus imageStatus) { DiskImage diskImage = getRelevantDiskImage(); - if (diskImage != null) { + if (diskImage != null && diskImage.getImageStatus() != imageStatus) { diskImage.setImageStatus(imageStatus); ImagesHandler.updateImageStatus(diskImage.getImage().getId(), imageStatus); } -- To view, visit http://gerrit.ovirt.org/21100 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I26a09ce674cfefd59819f3edf95accab31f0e80e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Ar <lara...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches