Liron Aravot has uploaded a new change for review. Change subject: core: avoid deadlocks image updated ......................................................................
core: avoid deadlocks image updated Currently VdsUpdateRuntimeInfo updates the disc_image_dynamic table according to the statistics retreived from the running vms. Those updates are executed in a batchUpdate call, which currently executes all the updates within the same transaction, as there is a FK between the disk_image_dynamic on postgres version earlier than 9.3 a lock will be taken on the referenced row which means that any other concurrent operation on those images may cause to a deadlock unless they are sorted. Sorting the images on all the flows in more tricky and unneeded as this issue has been resolved in postgres 9.3 (http://www.postgresql.org/docs/9.3/static/release-9-3.html) in the meanwhile we can drop the fk constraint and delete the records by adding trigger. Change-Id: Ifa160402787a7902169ab5fd3ce6661918fdebb2 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1112720 Signed-off-by: Liron Aravot <lara...@redhat.com> --- A packaging/dbscripts/upgrade/03_05_0720_drop_disk_image_dynamic_fk.sql 1 file changed, 12 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/36/29136/1 diff --git a/packaging/dbscripts/upgrade/03_05_0720_drop_disk_image_dynamic_fk.sql b/packaging/dbscripts/upgrade/03_05_0720_drop_disk_image_dynamic_fk.sql new file mode 100644 index 0000000..0de69af --- /dev/null +++ b/packaging/dbscripts/upgrade/03_05_0720_drop_disk_image_dynamic_fk.sql @@ -0,0 +1,12 @@ + + + +CREATE OR REPLACE FUNCTION fn_image_deleted() RETURNS TRIGGER AS $$ +BEGIN + DELETE FROM disk_image_dynamic dim WHERE DIM.image_id = OLD.image_guid; + RETURN OLD; +END; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER delete_disk_image_dynamic_for_image BEFORE DELETE ON IMAGES FOR EACH ROW +EXECUTE PROCEDURE fn_image_deleted() -- To view, visit http://gerrit.ovirt.org/29136 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifa160402787a7902169ab5fd3ce6661918fdebb2 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Aravot <lara...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches