Bug 1545660

Summary: Candlepin Liquibase validations errors are easy to miss due to a confusing ordering of messages
Product: Red Hat Satellite Reporter: Kavita <kgaikwad>
Component: CandlepinAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.14CC: bkearney, khowell, ktordeur
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1545765 (view as bug list) Environment:
Last Closed: 2019-10-02 16:08:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1545765    
Bug Blocks:    

Description Kavita 2018-02-15 12:52:32 UTC
Description of problem:

By seeing an output from cpdb --validate, it is hard to get information what went wrong in DB. So it would be better if command output show some meaningful information in error stack so that user can debug further.

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


How reproducible:


Steps to Reproduce:
1. Run command: cpdb --validate --verbose

SEVERE 11/01/18 9:13 AM: liquibase: db/changelog/changelog-validate.xml: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog:   Pool "402882e760e558670160e558bc2220cb" references an unresolvable product: doesnt_exist
SEVERE 11/01/18 9:13 AM: liquibase: db/changelog/changelog-validate.xml: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog: Org snowwhite (402882e760e558670160e55875f20004) failed data validation
INFO 11/01/18 9:13 AM: liquibase: db/changelog/changelog-validate.xml: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog: Validating data for org admin (402882e760e558670160e55875f20002) (2 of 3)
INFO 11/01/18 9:13 AM: liquibase: db/changelog/changelog-validate.xml: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog: Validating data for org donaldduck (402882e760e558670160e55875f20003) (3 of 3)
SEVERE 11/01/18 9:13 AM: liquibase: db/changelog/changelog-validate.xml: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog: Change Set db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog failed.  Error: liquibase.exception.CustomChangeException: liquibase.exception.DatabaseException: One or more orgs failed data validation
DEBUG 11/01/18 9:13 AM: liquibase: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog: Release Database Lock
DEBUG 11/01/18 9:13 AM: liquibase: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog: Executing UPDATE database command: UPDATE public.databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 11/01/18 9:13 AM: liquibase: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog: Successfully released change log lock
Unexpected error running Liquibase: liquibase.exception.CustomChangeException: liquibase.exception.DatabaseException: One or more orgs failed data validation

SEVERE 11/01/18 9:13 AM: liquibase: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog: liquibase.exception.CustomChangeException: liquibase.exception.DatabaseException: One or more orgs failed data validation
liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog:
     Reason: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CustomChangeException: liquibase.exception.DatabaseException: One or more orgs failed data validation
	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619)
	at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
	at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:79)
	at liquibase.Liquibase.update(Liquibase.java:214)
	at liquibase.Liquibase.update(Liquibase.java:192)
	at liquibase.integration.commandline.Main.doMigration(Main.java:1130)
	at liquibase.integration.commandline.Main.run(Main.java:188)
	at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CustomChangeException: liquibase.exception.DatabaseException: One or more orgs failed data validation
	at liquibase.change.custom.CustomChangeWrapper.generateStatements(CustomChangeWrapper.java:185)
	at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1257)
	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:582)
	... 7 more
Caused by: liquibase.exception.CustomChangeException: liquibase.exception.DatabaseException: One or more orgs failed data validation
	at org.candlepin.liquibase.LiquibaseCustomTaskWrapper.execute(LiquibaseCustomTaskWrapper.java:74)
	at liquibase.change.custom.CustomChangeWrapper.generateStatements(CustomChangeWrapper.java:180)
	... 9 more
Caused by: liquibase.exception.DatabaseException: One or more orgs failed data validation
	at org.candlepin.liquibase.PerOrgProductsMigrationValidationTask.execute(PerOrgProductsMigrationValidationTask.java:189)
	at org.candlepin.liquibase.LiquibaseCustomTaskWrapper.execute(LiquibaseCustomTaskWrapper.java:71)
	... 10 more

Actual results:
Showing error stack from which it is difficult to find out issue is due to bad product or bad content.

Expected results:
It should show why and which validation is failing at that point i.e product validation/content validation.

Additional info:

Comment 2 Kevin Howell 2018-02-15 15:19:30 UTC
*** Bug 1545655 has been marked as a duplicate of this bug. ***

Comment 3 Kevin Howell 2018-02-15 15:26:01 UTC
You can see that the root cause *is* present in the output:

SEVERE 11/01/18 9:13 AM: liquibase: db/changelog/changelog-validate.xml: db/changelog/20171108140157-perorgproducts-migration-validation.xml::20171108140157-1::crog:   Pool "402882e760e558670160e558bc2220cb" references an unresolvable product: doesnt_exist

However, because it occurs early in the file and is not present in the stacktrace, it's easy to miss.

We're considering options around collecting root causes in a separate file...

Comment 4 Bryan Kearney 2019-09-03 19:07:06 UTC
The Satellite Team is attempting to provide an accurate backlog of bugzilla requests which we feel will be resolved in the next few releases. We do not believe this bugzilla will meet that criteria, and have plans to close it out in 1 month. This is not a reflection on the validity of the request, but a reflection of the many priorities for the product. If you have any concerns about this, feel free to contact Red Hat Technical Support or your account team. If we do not hear from you, we will close this bug out. Thank you.

Comment 5 Bryan Kearney 2019-10-02 16:08:21 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.