Bug 669567 - updating ant bundle plugin failed during metadata update
Summary: updating ant bundle plugin failed during metadata update
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.0.0.B02
Hardware: Unspecified
OS: Unspecified
low
high
Target Milestone: ---
: ---
Assignee: John Sanda
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-14 01:12 UTC by John Mazzitelli
Modified: 2013-09-01 19:19 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-01 19:19:41 UTC
Embargoed:


Attachments (Terms of Use)
stacktrace.txt (20.56 KB, text/plain)
2011-01-14 01:13 UTC, John Mazzitelli
no flags Details

Description John Mazzitelli 2011-01-14 01:12:40 UTC
I just came across this bug after I rebuilt my ant bundle plugin and redeployed it. The server was down when I copied the new ant agent bundle plugin, then I restarted the server and got the attached exception during server startup.

I don't know why this happened. But to replicate, you probably need to deploy a ant bundle. I also did some things prior, like deleting bundle deployments, purging deployments, and deleting bundle versions. I don't know if any of that caused this or not.

Will attach error.txt.

Comment 1 John Mazzitelli 2011-01-14 01:13:07 UTC
Created attachment 473452 [details]
stacktrace.txt

Comment 2 John Sanda 2011-01-14 01:50:23 UTC
See this commit, aa3d4cd81b3854ca37f7235103807fedd6bde5d7, which is from the delete-agent-plugin branch and is now in master. Here is the relevant portion from the commit log:

  Add logic to delete bundles and bundle types
    
  ResourceMetadataManagerBean lacks support for deleting content-related
  stuff. With this commit, it now deletes bundles and bundle types that
  are associated with the resource type being deleted. I have also added
  tests to verify that bundles and bundle types are deleted.

So with JON 2.4, if you upgrade a bundle plugin, the original bundle and bundle type is not deleted, hence the constraint violation that you are seeing. I am looking at the commit, and we might be able to cherry-pick this over to the release-3.0.0 branch. There are two changes in the commit, both of which are additive. The first is the new code in ResourceMetadataManager bean to perform the deletion. The second is test code in ResourceMetadataManagerBeanTest.groovy which we don't care about.

Comment 3 John Sanda 2011-01-14 05:11:40 UTC
Upon closer inspection I see that that commit deals with resource type deletion and not with upgrading a resource type. It is/was during type deletion that the bundles and bundle types are not getting deleted. The commit mentioned in the previous comment may not be applicable here after all.

Comment 4 John Sanda 2011-01-14 21:16:55 UTC
Reproducing this error is straightforward. First deploy a bundle in RHQ. Then deploy an updated version of the ant bundle plugin. Any update will suffice to reproduce the exception. You can do something as simple as changing the version or changing the description.

The problem stems from the plugin update code treating bundles the same as content where it is really a special case. When the plugin is updated, we (incorrectly) compare package types and wind up deleting package types which leads to the database constraint violation in the exception. A bundle cannot even declare/have package types, so there is no reason to be comparing and deleting them.

Comment 5 John Sanda 2011-01-17 14:04:29 UTC
Fix pushed to master.

commit hash: 16f1caf77a3f0121530caebb737066191aa87cb3

Comment 6 Heiko W. Rupp 2013-09-01 19:19:41 UTC
Bulk closing of BZs that have no target version set, but which are ON_QA for more than a year and thus are in production for a long time.


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