modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 30 +++++++++- 1 file changed, 27 insertions(+), 3 deletions(-)
New commits: commit 26501218b106736b8b3d0f1fd1285177a08f9ea3 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 19 12:39:24 2012 -0500
[BZ 887411] don't uninventory everything just because we commited some top level server (cherry picked from commit d5564f3562ee960115cc533f029521000c870f45)
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 d95a976..7857bb7 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 @@ -1087,7 +1087,24 @@ public class InventoryManager extends AgentService implements ContainerService, return true; }
+ /** + * Performs a sync so that resources passed in are reflected in the agent's inventory. + * This assumes the resource sync infos passed in represent the full inventory tree. + * + * @param syncInfo information on all resources in the entire inventory tree + */ private void synchInventory(ResourceSyncInfo syncInfo) { + synchInventory(syncInfo, false); + } + + /** + * Performs a sync so that resources passed in are reflected in the agent's inventory. + * + * @param syncInfo the resources' sync data + * @param partialInventory if true, syncInfo represents only a partial inventory. + * if false, syncInfo represents the full inventory tree of all resources + */ + private void synchInventory(ResourceSyncInfo syncInfo, boolean partialInventory) { log.info("Syncing local inventory with Server inventory..."); long startTime = System.currentTimeMillis(); Set<Resource> syncedResources = new LinkedHashSet<Resource>(); @@ -1099,7 +1116,12 @@ public class InventoryManager extends AgentService implements ContainerService,
// rhq-980 Adding agent-side logging to report any unexpected synch failure. try { - getAllUuids(syncInfo, allServerSideUuids); + // don't bother doing this if we are processing a partial inventory. + // allServerSideUuids is only ever used to purge obsolete resources, but we don't + // do that for partial inventories, so we don't need to prepare that collection for partials. + if (!partialInventory) { + getAllUuids(syncInfo, allServerSideUuids); + }
log.debug("Processing Server sync info..."); processSyncInfo(syncInfo, syncedResources, unknownResourceIds, modifiedResourceIds, deletedResourceIds, @@ -1113,7 +1135,9 @@ public class InventoryManager extends AgentService implements ContainerService,
mergeUnknownResources(unknownResourceIds); mergeModifiedResources(modifiedResourceIds); - purgeObsoleteResources(allServerSideUuids); + if (!partialInventory) { + purgeObsoleteResources(allServerSideUuids); + } postProcessNewlyCommittedResources(newlyCommittedResources); if (log.isDebugEnabled()) { if (!deletedResourceIds.isEmpty()) { @@ -2164,7 +2188,7 @@ public class InventoryManager extends AgentService implements ContainerService, + "] and its descendants...");
// Get the latest resource data rooted at the given id. - synchInventory(syncInfo); + synchInventory(syncInfo, true); // this method assumes we only get a single resource and its children (BZ 887411) performServiceScan(syncInfo.getId()); // NOTE: This will block (the initial scan blocks). }
rhq-commits@lists.fedorahosted.org