Bug 1013341 - DB upgrade from 3.2 to 3.3 fails
Summary: DB upgrade from 3.2 to 3.3 fails
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: 3.3.0
Assignee: Moti Asayag
QA Contact: yeylon@redhat.com
URL:
Whiteboard: network
Depends On:
Blocks: 1019461
TreeView+ depends on / blocked
 
Reported: 2013-09-29 12:37 UTC by Eli Mesika
Modified: 2016-04-18 06:59 UTC (History)
10 users (show)

Fixed In Version: is17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Network
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
3.2 database (2.14 MB, application/x-tar)
2013-09-29 12:41 UTC, Eli Mesika
no flags Details
port mirroring is enabled (VM_Network_35_pm) (60.78 KB, image/png)
2013-10-02 14:08 UTC, awinter
no flags Details
port mirroring is enabled (VM_Network_35_pm) (60.78 KB, image/png)
2013-10-02 14:09 UTC, awinter
no flags Details
port mirroring is enabled (VM_Network_35_pm) (72.76 KB, image/png)
2013-10-02 14:10 UTC, awinter
no flags Details
Network was created with two profiles: one for pm and no for not. (70.23 KB, image/png)
2013-10-02 14:11 UTC, awinter
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 19656 0 None None None Never

Description Eli Mesika 2013-09-29 12:37:05 UTC
Description of problem:

upgrade script  03_03_0710_add_profile_to_network_interface.sql has the following code :

--START--

Create or replace FUNCTION __temp_has_port_mirroring_vm_interfaces(v_network_id UUID) RETURNS BOOLEAN
   AS $procedure$
BEGIN
   RETURN ((SELECT 1
   FROM vm_interface
   INNER JOIN vm_static
   ON vm_static.vm_guid = vm_interface.vm_guid
   INNER JOIN network_cluster
   ON network_cluster.cluster_id = vm_static.vds_group_id
   INNER JOIN network
   ON network.id = network_cluster.network_id
   AND network.name = vm_interface.network_name
   WHERE network.id = v_network_id
   AND port_mirroring = TRUE) IS NOT NULL);
END; $procedure$
LANGUAGE plpgsql;

--END--

When this function is called, it expects to return one value which is boolean.
On the attached database more than one row is returned and breaks the upgrade as you can see in the log:

psql:upgrade/03_03_0710_add_profile_to_network_interface.sql:80: ERROR:  more than one row returned by a subquery used as an expression
CONTEXT:  SQL statement "SELECT  ((SELECT 1 FROM vm_interface INNER JOIN vm_static ON vm_static.vm_guid = vm_interface.vm_guid INNER JOIN network_cluster ON network_cluster.cluster_id = vm_static.vds_group_id INNER JOIN network ON network.id = network_cluster.network_id AND network.name = vm_interface.network_name WHERE network.id =  $1  AND port_mirroring = TRUE) IS NOT NULL)"
PL/pgSQL function "__temp_has_port_mirroring_vm_interfaces" line 2 at RETURN


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Restore 3.3 database from attached file using pg_restore
2. Try to upgrade manually to 3.3 using upgrade.sh
3.

Actual results:
Upgrade fails with ERROR:  more than one row returned by a subquery used as an expression

Expected results:
Upgrade should complete successfully 

Additional info:

Comment 1 Eli Mesika 2013-09-29 12:41:08 UTC
Created attachment 804672 [details]
3.2 database

Comment 2 Eli Mesika 2013-09-29 12:42:50 UTC
(In reply to Eli Mesika from comment #0)
sorry , should be:

Steps to Reproduce:
1. Restore 3.2 database from attached file using pg_restore
2. Try to upgrade manually to 3.3 using upgrade.sh
3.

Comment 3 awinter 2013-10-02 14:08:06 UTC
Created attachment 806503 [details]
port mirroring is enabled (VM_Network_35_pm)

Comment 4 awinter 2013-10-02 14:09:30 UTC
Created attachment 806504 [details]
port mirroring is enabled (VM_Network_35_pm)

Verified.
Screen shot 1 of 3

Comment 5 awinter 2013-10-02 14:10:47 UTC
Created attachment 806505 [details]
port mirroring is enabled (VM_Network_35_pm)

Verified.
Screen shot 2 of 3

Comment 6 awinter 2013-10-02 14:11:59 UTC
Created attachment 806517 [details]
Network was created with two profiles: one for pm and no for not.

Verified.
Screen shot 3 of 3

Comment 7 awinter 2013-10-02 14:12:47 UTC
Verified.
See attachments.

Comment 9 Itamar Heim 2014-01-21 22:32:17 UTC
Closing - RHEV 3.3 Released

Comment 10 Itamar Heim 2014-01-21 22:32:20 UTC
Closing - RHEV 3.3 Released


Note You need to log in before you can comment on or make changes to this bug.