Bug 795559

Summary: cannot change subcategory metadata if resource type has been extended
Product: [Other] RHQ Project Reporter: John Mazzitelli <mazz>
Component: Core ServerAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED WORKSFORME QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2CC: hrupp, mazz
Target Milestone: ---   
Target Release: RHQ 4.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-30 20:33:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Mazzitelli 2012-02-20 21:59:03 UTC
If you extend one resource type via the "embedded style" of plugin extension, and that "parent" resource type has <subcategories>, you cannot change those subcategories, otherwise database deadlocks occurs.

Example - you have two plugins. The "parent" plugin with a "parent" resource type and a "child" plugin with a "child" resource type that simply extends the parent type:

   -------------------------
   parent plugin descriptor:
   -------------------------
   <plugin name="ParentPlugin" version="1.0">
       <server name="ParentServerA">
           <subcategories>
               <subcategory name="A-subcat"/>
           </subcategories>
   ...

   -------------------------
   child plugin descriptor:
   -------------------------

   <plugin name="ChildPlugin">
       <server name="ChildServerA"
               sourcePlugin="ParentPlugin"
               sourceType="ParentServerA">
       </server>
   ...

Now, suppose you upgrade the parent plugin. As part of the changes to the new parent plugin, you want to add a new subcategory:

   <plugin name="ParentPlugin" version="2.0">
       <server name="ParentServerA">
           <subcategories>
               <subcategory name="A-subcat"/>
               <subcategory name="A-subcat-NEW"/> <!-- a new subcategory -->
           </subcategories>
   ...

Once you deploy this new parent plugin and the system attempts to upgrade the metadata, their appears to be some kind of database deadlock. Removing the new subcategory from the new descriptor (that is, leave the subcategories the same from the original plugin) and things work and the upgrade completes.

(note: I saw this while writing a unit test for bug #747925)

Comment 1 Mike Foley 2012-02-27 17:13:04 UTC
triage 2/27/2012 mfoley, asantos, crouch, loleary

Comment 2 Heiko W. Rupp 2013-07-23 09:19:21 UTC
I tried to reproduce this by first adding 
    <subcategories>
       <subcategory name="foo"/>
     </subcategories>
To 
   <server name="JMX Server" discovery="JMXDiscoveryComponent"

which is e.g. used in 


    <server name="JBoss AS JVM" description="JVM of the JBoss AS" sourcePlugin="JMX" sourceType="JMX Server"

and similar for storage-plugin and agent-plugin.

Deployed the updated plugin into the running server without issues.
Then added another <subcategory> and deployed again without issues.

Can you please give more information on how to reproduce?

Comment 3 John Mazzitelli 2013-07-23 13:22:07 UTC
(In reply to Heiko W. Rupp from comment #2)
> I tried to reproduce this by first adding 
>     <subcategories>
>        <subcategory name="foo"/>
>      </subcategories>
> To 
>    <server name="JMX Server" discovery="JMXDiscoveryComponent"
> 
> which is e.g. used in 
> 
> 
>     <server name="JBoss AS JVM" description="JVM of the JBoss AS"
> sourcePlugin="JMX" sourceType="JMX Server"
> 
> and similar for storage-plugin and agent-plugin.
> 
> Deployed the updated plugin into the running server without issues.
> Then added another <subcategory> and deployed again without issues.
> 
> Can you please give more information on how to reproduce?

This issue's description is all that I have for reproduction steps (I thought those steps were actually pretty detailed :)

It's possible this has been fixed by other changes in the past year and a half.

Comment 4 Heiko W. Rupp 2013-08-30 20:33:06 UTC
The original issue can not be reproduced any more.

If this shows up agin, we need to re-open.