Alona Kaplan has uploaded a new change for review. Change subject: engine: Adding unique(vds_id, name) constraint to vds_interface ......................................................................
engine: Adding unique(vds_id, name) constraint to vds_interface and removing duplicate entiries in case there were any. Due to a bug that was already fixed, more than one GetCaps could be executed simultaniusly. And in some snerios of the race the same nics could be created more than once. This patch cleans the duplicate entities from vds_interface table (leaves just the last updated entry). Change-Id: I2ae0c11afb751ec28b8f71e70959546ba306444f Signed-off-by: Alona Kaplan <alkap...@redhat.com> --- A packaging/dbscripts/upgrade/03_06_1480_cleanup_duplicates_from_vds_interface.sql 1 file changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/29/42429/1 diff --git a/packaging/dbscripts/upgrade/03_06_1480_cleanup_duplicates_from_vds_interface.sql b/packaging/dbscripts/upgrade/03_06_1480_cleanup_duplicates_from_vds_interface.sql new file mode 100644 index 0000000..9d5234d --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_1480_cleanup_duplicates_from_vds_interface.sql @@ -0,0 +1,9 @@ +-- Adding unique(vds_id, name) constraint to vds_interface and removing duplicate entiries in case there were any +DELETE FROM vds_interface +WHERE id IN (SELECT id + FROM (SELECT id, + row_number() over (partition BY vds_id, name ORDER BY _update_date) AS rnum + FROM vds_interface) t + WHERE t.rnum > 1); + +select fn_db_create_constraint('vds_interface', 'vds_interface_vds_id_name_unique', 'unique (vds_id, name)'); -- To view, visit https://gerrit.ovirt.org/42429 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2ae0c11afb751ec28b8f71e70959546ba306444f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <alkap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches