Liron Ar has uploaded a new change for review.
Change subject: core: avoid deadlock in images
......................................................................
core: avoid deadlock in images
Currently the images table contains a foreign key to itself (quoting from
the table definition) :
...
TABLE "images" CONSTRAINT "image_templates_images" FOREIGN KEY
(it_guid) REFERENCES images(image_guid)
...
The column it_guid in the images table indicates what is the template
that the image is based on.
In postgres versions earlier than 9.3, when executing a update to a row
with a foreign key, a lock on the referenced record is taken which means
that we have a chance for a deadlock in the following scenarios:
1. Simultenous update to the template disks and to the disks of a vm
based on the template.
2. Simultenous update to disks of vms based on the same template.
This issue has been resolved in postgres 9.3
(http://www.postgresql.org/docs/9.3/static/release-9-3.html see
E.5.3.1.1), till we'll enforce usage of that version we can drop that foreign
key constraint which will also align it with the parentid column that we don't
a FK on as well.
Regardless of that, we should remove unneeded updates to images in
different flows.
Change-Id: Ib4939a716cef8901b53a90499201d815a4e3cb58
Bug-Url: https://bugzilla.redhat.com/1077715
Signed-off-by: Liron Aravot <[email protected]>
---
A packaging/dbscripts/upgrade/03_05_0590_drop_images_fk.sql
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/09/28409/1
diff --git a/packaging/dbscripts/upgrade/03_05_0590_drop_images_fk.sql
b/packaging/dbscripts/upgrade/03_05_0590_drop_images_fk.sql
new file mode 100644
index 0000000..37f9062
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_05_0590_drop_images_fk.sql
@@ -0,0 +1 @@
+ALTER TABLE images DROP CONSTRAINT image_templates_images;
--
To view, visit http://gerrit.ovirt.org/28409
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4939a716cef8901b53a90499201d815a4e3cb58
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches