Bug 893459 - Installer pre-upgrade step should ensure DB consistency using fkvalidator.sh
Summary: Installer pre-upgrade step should ensure DB consistency using fkvalidator.sh
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-setup
Version: 3.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.2.0
Assignee: Alex Lourie
QA Contact: Pavel Stehlik
URL:
Whiteboard: integration
Depends On: 912305 915925
Blocks: 948448
TreeView+ depends on / blocked
 
Reported: 2013-01-09 11:35 UTC by Eli Mesika
Modified: 2015-09-22 13:09 UTC (History)
8 users (show)

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


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 12512 0 None MERGED packaging: Added generic DB validations before the upgrade 2021-02-01 10:23:05 UTC
oVirt gerrit 14597 0 None MERGED core: Installer pre-upgrade step should ensure... 2021-02-01 10:23:05 UTC

Description Eli Mesika 2013-01-09 11:35:54 UTC
Description of problem:
When upgrading real customer databases we ha encounter sometimes that DB had inconsistent data, mostly by data added manually in a way that breaks a Foreign Key constraint.

Installer pre upgrade step should run fkvalidaor.sh to chekc DB consistency and if any such are found, the user should approve running fkvalidaor.sh with the -f flag that forces removal of the inconsistent data.

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


How reproducible:
always

Steps to Reproduce:
1.take any parent/child tables (for example job & step)
2.force insertion of illegal data to the child table by disabling child table triggers 
ALTER TABLE <child table> DISABLE TRIGGER ALL;
3.Insert a row in child that breaks the FK
4. ALTER TABLE <child table> ENABLE TRIGGER ALL;
5. use pg_dump to backup the database
6. use pg_restore to restore the database
  
Actual results:
You will get a FK violation error

Expected results:

FK violations should be trapped and resolved in the pre-upgrade step
Additional info:
see
fkvalidaor.sh --help

Comment 1 Barak 2013-01-09 12:07:14 UTC
can the fkvalidator.sh list of inconsistencies ?
Please add the --help of the tool to this BZ.

Comment 2 Eli Mesika 2013-01-09 12:18:43 UTC
(In reply to comment #1)
> can the fkvalidator.sh list of inconsistencies ?
> Please add the --help of the tool to this BZ.

Yes

Usage: fkvalidator.sh [-h] [-s SERVERNAME [-p PORT]] [-d DATABASE] [-u USERNAME] [-l LOGFILE] [-f] [-v]

 -s SERVERNAME - The database servername for the database  (def. localhost)
 -p PORT       - The database port for the database        (def. 5432)
 -d DATABASE   - The database name                         (def. engine)
 -u USERNAME   - The admin username for the database.
 -l LOGFILE    - The logfile for capturing output          (def. fkvalidator.sh.log)
 -f            - Fix the non consistent data by removing it from DB.
 -v            - Turn on verbosity                         (WARNING: lots of output)
 -h            - This help text.

Comment 3 Eli Mesika 2013-01-09 12:20:55 UTC
examples

1) listing violations
fkvalidator.sh -u postgres -d engine 

2) resolving violations
fkvalidator.sh -u postgres -d engine -f

Comment 4 Alex Lourie 2013-02-18 10:04:59 UTC
Hi Eli

Please do with this the same as with taskcleaner.sh and put it in the different folder.

Thanks.

Comment 8 Eli Mesika 2013-05-08 17:28:08 UTC
We had found a problem in fkvalidator when the child table has a value that not exists in the parent table but this value is null.
Moving BZ to POST in order to fix that as suggested by Moran

Comment 10 Itamar Heim 2013-06-11 09:45:19 UTC
3.2 has been released

Comment 11 Itamar Heim 2013-06-11 09:45:20 UTC
3.2 has been released

Comment 12 Itamar Heim 2013-06-11 09:55:56 UTC
3.2 has been released


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