Bug 893459 - Installer pre-upgrade step should ensure DB consistency using fkvalidator.sh
Installer pre-upgrade step should ensure DB consistency using fkvalidator.sh
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-setup (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 3.2.0
Assigned To: Alex Lourie
Pavel Stehlik
Depends On: 912305 915925
Blocks: 948448
  Show dependency treegraph
Reported: 2013-01-09 06:35 EST by Eli Mesika
Modified: 2015-09-22 09 EDT (History)
8 users (show)

See Also:
Fixed In Version: sf16
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 12512 None None None Never
oVirt gerrit 14597 None None None Never

  None (edit)
Description Eli Mesika 2013-01-09 06:35:54 EST
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:

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 
3.Insert a row in child that breaks the FK
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:
fkvalidaor.sh --help
Comment 1 Barak 2013-01-09 07:07:14 EST
can the fkvalidator.sh list of inconsistencies ?
Please add the --help of the tool to this BZ.
Comment 2 Eli Mesika 2013-01-09 07:18:43 EST
(In reply to comment #1)
> can the fkvalidator.sh list of inconsistencies ?
> Please add the --help of the tool to this BZ.


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 07:20:55 EST

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 05:04:59 EST
Hi Eli

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

Comment 8 Eli Mesika 2013-05-08 13:28:08 EDT
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 05:45:19 EDT
3.2 has been released
Comment 11 Itamar Heim 2013-06-11 05:45:20 EDT
3.2 has been released
Comment 12 Itamar Heim 2013-06-11 05:55:56 EDT
3.2 has been released

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