Change in ovirt-engine[master]: core: avoid deadlock in images

laravot at redhat.com laravot at redhat.com
Sun Jun 8 06:54:07 UTC 2014


Liron Ar has submitted this change and it was merged.

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 <laravot at redhat.com>
---
A packaging/dbscripts/upgrade/03_05_0600_drop_images_fk.sql
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Liron Ar: Verified; Looks good to me, approved



-- 
To view, visit http://gerrit.ovirt.org/28409
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib4939a716cef8901b53a90499201d815a4e3cb58
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <laravot at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Liron Ar <laravot at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list