Bug 813427

Summary: JDBC error when trying to delete org.
Product: Red Hat Satellite Reporter: Corey Welton <cwelton>
Component: WebUIAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Corey Welton <cwelton>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: cpelland, dgoodwin, jsherril, mmccune
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-15 18:59:38 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:
Bug Depends On:    
Bug Blocks: 812346    
Attachments:
Description Flags
relevant catalina log none

Description Corey Welton 2012-04-17 18:28:13 UTC
Discovered when trying to test bug #812346. I have repeated this four times in a row -- three after having created environments (per aformentioned bz) and once w/o creating environments 


1. Create org 812346
3. Switch to org 812346; Upload manifest
4. Enable repo 6Server - x86_64 - Red Hat Enterprise Linux 6 Server RPMs x86_64
5. 6Server; do not promote
6. Switch to ACME_Corporation
7. Attempt to delete 812346
8. Navigate around the UI a bit, or perhaps just try to create another org (812346_new or what have you).  

Current result:

Org delete is scheduled for background deletion
Upon attempting to delete org:

Candlepin::Content: 500 Internal Server Error {"displayMessage":"Runtime Error
Could not execute JDBC batch update at
org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598"}
(DELETE /candlepin/content/861)

At this point, the org has disappeared from the UI, but still exists in the
background - and user cannot use the manifest from before, as CFSE thinks the
manifest is still in use.

katello-0.1.310-1.el6_2.noarch
katello-all-0.1.310-1.el6_2.noarch
candlepin-0.5.27-1.el6.noarch


Expected result:
* Org is deleted
* If org fails to be deleted, we don't end up in a wedged state.

Will be attaching relevant tomcat logs


Other notes:
Probably blocks testing for bug #812346

Comment 1 Corey Welton 2012-04-17 18:32:14 UTC
Created attachment 578120 [details]
relevant catalina log

Comment 2 Corey Welton 2012-04-17 18:36:30 UTC
per jsherrill, this is different than bug #812346, evidenced by the fact that it does not require the creation of environments.

Comment 3 Devan Goodwin 2012-04-18 18:20:48 UTC
Candlepin is refusing to delete the content as a product is still set to reference it. This might be wrong and Candlepin should cleanup any product references, but it also might be acting correctly and preventing the deletion of something that crosses organizations, a RH product for example.

I guess it's a question of what product was still referencing that content?

I would try to look at the results of some SQL queries after this happens:

select * from cp_product_content where content_id = failedID;

Then match up with cp_product and see which product that is, is it something used across orgs? 

If this is custom content involved, and definitely isn't used in another org, then we need to decide if Katello can/should delete the product first, or if Candlepin should clean up the references automatically. Given the global nature of products though I am tempted to leave the restriction in place and see if we can't get Katello doing product delete prior to content delete.

(bearing in mind content can be shared by multiple products, used by subscriptions in multiple orgs)

Comment 4 Justin Sherrill 2012-04-18 19:24:36 UTC
some information:  



    candlepin=# select * from cp_product_content where content_id = '861';
    product_id | content_id | enabled | created | updated
    ------------+------------+---------+---------+---------
    RH0103708 | 861 | f | |
    (1 row)
     
     
    candlepin=# select name from cp_product where id = 'RH0103708';
    name
    -----------------------------------------------------------------------
    Red Hat Enterprise Linux Server, Premium (8 sockets) (Up to 4 guests)
    (1 row)

Comment 5 Justin Sherrill 2012-04-19 18:54:01 UTC
katello fix:

37f0e5a5d77bbe28fb8dd45dd7c5f358de771c9d

no longer deleting content objects from candlepin in the case of a redhat consumer.  We still disassociate the content from the product in all cases.

Comment 6 Justin Sherrill 2012-04-19 19:00:05 UTC
actually that was the incorrect hash, still waiting on ack.

Comment 7 Justin Sherrill 2012-04-19 20:15:45 UTC
fixed in katello:

c89ceafb4d6b09e53898596be67cebe23926bd40

Comment 10 Corey Welton 2012-04-23 15:33:16 UTC
QA Verified in latest brewroot - CloudForms System Engine Version: 0.1.311-1.el6_2

Comment 11 errata-xmlrpc 2012-05-15 18:59:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2012-0665.html