Bug 1091227 - [dbscripts] engine-setup fails: ERROR: insert or update on table "tags_user_map" violates foreign key constraint "tags_user_map_user"
Summary: [dbscripts] engine-setup fails: ERROR: insert or update on table "tags_user_m...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.4.0
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: 3.4.0
Assignee: Yair Zaslavsky
QA Contact: Jiri Belka
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-25 09:06 UTC by Jiri Belka
Modified: 2016-02-10 19:29 UTC (History)
12 users (show)

Fixed In Version: org.ovirt.engine-root-3.4.0-17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
ovirt-engine-setup-20140425103134.log (941.15 KB, text/x-log)
2014-04-25 09:06 UTC, Jiri Belka
no flags Details
engine-20140425103813.fGPMA7.sql (285.17 KB, application/x-gzip)
2014-04-28 07:04 UTC, Jiri Belka
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 27184 0 master MERGED core: Fix temproaral disabling foreign keys Never
oVirt gerrit 27185 0 ovirt-engine-3.4 MERGED core: Fix temproaral disabling foreign keys Never
oVirt gerrit 27195 0 master MERGED core: Fix temproaral disabling foreign keys Never

Description Jiri Belka 2014-04-25 09:06:54 UTC
Created attachment 889568 [details]
ovirt-engine-setup-20140425103134.log

Description of problem:
I had a tag creates 'users' and assigned to an user in my setup. engine-setup failed because of this tag. Removing the tag made engine-setup to pass.

...snip...
2014-04-25 10:38:21 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.execute:446 execute-output: ['/usr/share/ovirt-engine/dbscripts/upgrade.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20140425103134.log', '-g'] stderr:
psql:upgrade/03_04_0740_update_user_ids.sql:37: ERROR:  insert or update on table "tags_user_map" violates foreign key constraint "tags_user_map_user"
DETAIL:  Key (user_id)=(215a64da-6961-40d8-b91a-79cf3c1b49d8) is not present in table "users".
CONTEXT:  SQL statement "UPDATE tags_user_map m set user_id = ( SELECT temp_id FROM users WHERE user_id = m.user_id)"
PL/pgSQL function "__temp_update_user_ids_03_04_0740" line 17 at SQL statement

2014-04-25 10:38:22 DEBUG otopi.context context._executeMethod:152 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/otopi/context.py", line 142, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/ovirt-engine/db/schema.py", line 345, in _miscUpgrade
    osetupcons.DBEnv.PGPASS_FILE
  File "/usr/lib/python2.6/site-packages/otopi/plugin.py", line 451, in execute
    command=args[0],
RuntimeError: Command '/usr/share/ovirt-engine/dbscripts/upgrade.sh' failed to execute
2014-04-25 10:38:22 ERROR otopi.context context._executeMethod:161 Failed to execute stage 'Misc configuration': Command '/usr/share/ovirt-engine/dbscripts/upgrade.sh' failed to execute
...snip...

engine=# select user_id,name from users;                                                                                                 
               user_id                |    name    
--------------------------------------+------------
 fdfc627c-d875-11e0-90f0-83df133b58cc | admin
 22341bfe-195b-421c-8bad-b9c16c8545c2 | ad-w2k8r2
 b8b52a4f-7f82-46f7-8ede-973d2489066b | ad-w2k12r2
 939b52b6-57d4-4545-b318-8f43ec2e7a22 | admin
 03e5248f-0b4f-4182-98c1-8808635525f4 | vdcadmin2
 7ce4c3e8-66b3-4a24-92ad-ea1fc43c769b | vdcadmin
(6 rows)

engine=# select * from tags_user_map;
                tag_id                |               user_id                |         _create_date         
--------------------------------------+--------------------------------------+------------------------------
 503acfc8-39e9-4774-9cc6-95ba51a23e0a | b8b52a4f-7f82-46f7-8ede-973d2489066b | 2014-04-25 10:20:07.79119+02
(1 row)

Version-Release number of selected component (if applicable):
av6.1 / rhevm-3.4.0-0.13.beta3.el6ev.noarch

How reproducible:
???

Steps to Reproduce:
1. assing a tag to a user
2. do update from av6.1 to av7 via engine-setup
3.

Actual results:
update fails

Expected results:
should pass

Additional info:

Comment 1 Yair Zaslavsky 2014-04-27 08:21:51 UTC
Can you please attach a backup of your database?

Comment 2 Yair Zaslavsky 2014-04-27 08:22:08 UTC
Can you please attach a backup of your database?

Comment 3 Jiri Belka 2014-04-28 07:04:19 UTC
Created attachment 890346 [details]
engine-20140425103813.fGPMA7.sql

Comment 4 Jiri Belka 2014-05-13 13:27:47 UTC
ok, av9, update worked from av6.1.

Comment 5 Itamar Heim 2014-06-12 14:07:06 UTC
Closing as part of 3.4.0


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