fix for InventoryManager.mergeUnknownResources

Joseph Marques jmarques at redhat.com
Tue Nov 2 03:08:44 UTC 2010


  Mazz, good catch.

What is the next effect of this fix?  I notice that size of the 
'unknownResourceIds' collection is, in part, responsible for a 
subsequent availability check and resource service scan.  When the 
collection size is incorrect - in the context of the larger inventory 
synchronization process - what would the net effect of the previous 
logic error be?  Specifically, under what conditions would it trigger an 
unnecessary availability check and service scan (false positive)?  Under 
what conditions would it miss them (false negative)?  I'm satisfied by 
inspection that this fix is correct, but I'd still like to know what 
users (who lack the fix) would experience in terms of inventory 
synchronization.  On that note, shouldn't this be pushed to the latest 
cumulative patch branch?  Do you think this requires a BZ to track?

On 10/29/2010 04:57 PM, mazz wrote:
>   modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java |  136 +++++-----
>   1 file changed, 73 insertions(+), 63 deletions(-)
>
> New commits:
> commit 7155896be74b82b2a9be7b1358103a4e2182fbcf
> Author: John Mazzitelli<mazz at redhat.com>
> Date:   Fri Oct 29 16:52:44 2010 -0400
>
>      we need to remove the disabled resource's IDs from the callers set - removing resources from our internal resource set is useless
>
> diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
> index 4c3b345..e483bb7 100644
> --- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
> +++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
> @@ -2449,7 +2449,7 @@ public class InventoryManager extends AgentService implements ContainerService,
>               Set<Resource>  unknownResources = configuration.getServerServices().getDiscoveryServerService()
>                   .getResources(unknownResourceIds, true);
>
> -            Set<Resource>  toBeIgnored = new HashSet<Resource>();
> +            Set<Integer>  toBeIgnored = new HashSet<Integer>();
>
>               for (Resource unknownResource : unknownResources) {
>                   ResourceType resourceType = pmm.getType(unknownResource.getResourceType());
> @@ -2457,7 +2457,7 @@ public class InventoryManager extends AgentService implements ContainerService,
>                       mergeResource(unknownResource);
>                       syncSchedulesRecursively(unknownResource);
>                   } else {
> -                    toBeIgnored.add(unknownResource);
> +                    toBeIgnored.add(unknownResource.getId());
>                       if (log.isDebugEnabled()) {
>                           log.debug("During an inventory sync, the server gave us resource [" + unknownResource
>                               + "] but its type is disabled in the agent; ignoring it");
> @@ -2465,7 +2465,7 @@ public class InventoryManager extends AgentService implements ContainerService,
>                   }
>               }
>
> -            unknownResources.removeAll(toBeIgnored);
> +            unknownResourceIds.removeAll(toBeIgnored);
>           }
>           return;
>       }


More information about the rhq-devel mailing list