Upgrade from 4.3.2 to 4.3.3 fails on database schema update

Tried to upgrade to 4.3.3, and during engine-setup I get: 2019-04-20 14:24:47,041-0400 Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql'... 2019-04-20 14:24:47,043-0400 dbfunc_psql_die --file=/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql ********* QUERY ********** SELECT fn_db_create_constraint('image_transfers', 'fk_image_transfers_command_enitites', 'FOREIGN KEY (command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); ************************** 2019-04-20 14:24:47,060-0400 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.executeRaw:863 execute-result: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20190420142153-s5heq0.log', '-c', 'apply'], rc=1 2019-04-20 14:24:47,060-0400 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.execute:921 execute-output: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20190420142153-s5heq0.log', '-c', 'apply'] stdout: 2019-04-20 14:24:47,061-0400 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.execute:926 execute-output: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20190420142153-s5heq0.log', '-c', 'apply'] stderr: psql:/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql:3: ERROR: insert or update on table "image_transfers" violates foreign key constraint "fk_image_transfers_command_enitites" DETAIL: Key (command_id)=(7d68555a-71ee-41f5-9f12-0b26b6b9d449) is not present in table "command_entities". CONTEXT: SQL statement "ALTER TABLE image_transfers ADD CONSTRAINT fk_image_transfers_command_enitites FOREIGN KEY (command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE" PL/pgSQL function fn_db_create_constraint(character varying,character varying,text) line 9 at EXECUTE FATAL: Cannot execute sql command: --file=/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql 2019-04-20 14:24:47,061-0400 ERROR otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema schema._misc:432 schema.sh: FATAL: Cannot execute sql command: --file=/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql 2019-04-20 14:24:47,061-0400 DEBUG otopi.context context._executeMethod:145 method exception Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/otopi/context.py", line 132, in _executeMethod method['method']() File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/ovirt-engine/db/schema.py", line 434, in _misc raise RuntimeError(_('Engine schema refresh failed')) RuntimeError: Engine schema refresh failed 2019-04-20 14:24:47,064-0400 ERROR otopi.context context._executeMethod:154 Failed to execute stage 'Misc configuration': Engine schema refresh failed 2019-04-20 14:24:47,065-0400 DEBUG otopi.transaction transaction.abort:119 aborting 'Yum Transaction' 2019-04-20 14:24:47,065-0400 INFO otopi.plugins.otopi.packagers.yumpackager yumpackager.info:80 Yum Performing yum transaction rollback

Hello, On 4/20/19 9:10 PM, eshwayri@gmail.com wrote:
Tried to upgrade to 4.3.3, and during engine-setup I get:
2019-04-20 14:24:47,041-0400 Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql'... 2019-04-20 14:24:47,043-0400 dbfunc_psql_die --file=/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql ********* QUERY ********** SELECT fn_db_create_constraint('image_transfers', 'fk_image_transfers_command_enitites', 'FOREIGN KEY (command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); **************************
2019-04-20 14:24:47,060-0400 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.executeRaw:863 execute-result: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20190420142153-s5heq0.log', '-c', 'apply'], rc=1 2019-04-20 14:24:47,060-0400 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.execute:921 execute-output: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20190420142153-s5heq0.log', '-c', 'apply'] stdout:
2019-04-20 14:24:47,061-0400 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.execute:926 execute-output: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20190420142153-s5heq0.log', '-c', 'apply'] stderr: psql:/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql:3: ERROR: insert or update on table "image_transfers" violates foreign key constraint "fk_image_transfers_command_enitites" DETAIL: Key (command_id)=(7d68555a-71ee-41f5-9f12-0b26b6b9d449) is not present in table "command_entities". CONTEXT: SQL statement "ALTER TABLE image_transfers ADD CONSTRAINT fk_image_transfers_command_enitites FOREIGN KEY (command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE" PL/pgSQL function fn_db_create_constraint(character varying,character varying,text) line 9 at EXECUTE FATAL: Cannot execute sql command: --file=/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql There are left some non active image transfers. Remove them in the database running upgrade script 04_03_0265_remove_foreign_key_in_image_transfers.sql
$ scl enable rh-postgresql10 bash $ psql engine engine=# DELETE FROM image_transfers WHERE command_id NOT IN (SELECT command_entities.command_id FROM command_entities); It should be fixed for newer ovirt versions.
2019-04-20 14:24:47,061-0400 ERROR otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema schema._misc:432 schema.sh: FATAL: Cannot execute sql command: --file=/usr/share/ovirt-engine/dbscripts/upgrade/04_03_0830_add_foreign_key_to_image_transfers.sql 2019-04-20 14:24:47,061-0400 DEBUG otopi.context context._executeMethod:145 method exception Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/otopi/context.py", line 132, in _executeMethod method['method']() File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/ovirt-engine/db/schema.py", line 434, in _misc raise RuntimeError(_('Engine schema refresh failed')) RuntimeError: Engine schema refresh failed 2019-04-20 14:24:47,064-0400 ERROR otopi.context context._executeMethod:154 Failed to execute stage 'Misc configuration': Engine schema refresh failed 2019-04-20 14:24:47,065-0400 DEBUG otopi.transaction transaction.abort:119 aborting 'Yum Transaction' 2019-04-20 14:24:47,065-0400 INFO otopi.plugins.otopi.packagers.yumpackager yumpackager.info:80 Yum Performing yum transaction rollback _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/2BA3WQYBT2X3MX... Best regards,
-- Lucie Leistnerova Quality Engineer, QE Cloud, RHVM Red Hat EMEA IRC: lleistne @ #rhev-qe

Thank you; that worked. Upgrade completed successfully.
participants (2)
-
eshwayri@gmail.com
-
Lucie Leistnerova