Bug 669567 - updating ant bundle plugin failed during metadata update
updating ant bundle plugin failed during metadata update
Product: RHQ Project
Classification: Other
Component: Core Server (Show other bugs)
Unspecified Unspecified
low Severity high (vote)
: ---
: ---
Assigned To: John Sanda
Mike Foley
Depends On:
  Show dependency treegraph
Reported: 2011-01-13 20:12 EST by John Mazzitelli
Modified: 2013-09-01 15:19 EDT (History)
1 user (show)

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

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

  None (edit)
Description John Mazzitelli 2011-01-13 20:12:40 EST
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-13 20:13:07 EST
Created attachment 473452 [details]
Comment 2 John Sanda 2011-01-13 20:50:23 EST
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 00:11:40 EST
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 16:16:55 EST
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 09:04:29 EST
Fix pushed to master.

commit hash: 16f1caf77a3f0121530caebb737066191aa87cb3
Comment 6 Heiko W. Rupp 2013-09-01 15:19:41 EDT
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.