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 d5564f3562ee960115cc533f029521000c870f45
Author: John Mazzitelli <mazz(a)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
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 473b0d0..eaca661 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()) {
@@ -2188,7 +2212,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).
}
Show replies by date