It seems we keep around DELETED resources in order to display deleted resource history. These deleted resources continue to show up in the server's resource inventory since ResourceSyncInfo does not filter any resources based on status, it reports the resource hierarchy as is. This results in repeated logging on the agent and server and unnecessary inventory report updates. I'm seeing inventory reports every 18 seconds from my single agent, the agent continually processing these unknown resources.
To be clear, this is the result of a DELETE, not an uninventory. The fact that the DELETED resources were treated as unknown forced the avail report and a service level scan. But the unknown resources were removed from the PC inventory after the fact, since they were DELETED. So, they were always unknown to the PC, the scans then repeated ad infinitum. The DELETED resources are still reported by the server as part of ResourceSyncInfo. This would be a bit difficult to change at the moment since RSI lies directly on top of the resource table. The DELETED resources are really of no use to the agent/PC, and so the solution was to just ignore them completely when processing the sync info. So, we report a little more info from the server and it is discarded (a count of the ignored, DELETED, resources is logged in debug). This does not affect the DELETE operation on the GUI. Deletes are not handled via the sync code, they are handled as separate requests to the PC that can succeed or fail. In fact they can not succeed when the agent or parent resource is unavailable.
Test Procedure: 1) Start up a server and client 2) monitor the agent log and the server log 3) Delete (not uninventory, the "Delete" button) an inventoried resource, for example, a JMS queue. 4) If you don't see inventory report and discovery running repeatedly, like every 20 seconds, then things are working. Otherwise you'll see repeating log messages on the server and in the agent log.
QA Verified in CR2. After deleting a war file: (Agent) 2008-10-07 13:34:14,418 INFO [ResourceFactory.executor-1] (rhq.core.pc.inventory.DeleteResourceRunner)- Deleting resource from request: 500550 2008-10-07 13:34:25,549 INFO [MeasurementManager.sender-1] (rhq.core.pc.measurement.MeasurementCollectorRunner)- Measurement collection for [8] metrics took 2517ms - sending report to Server... (Server) 2008-10-07 13:34:12,626 INFO [org.rhq.enterprise.server.discovery.DiscoveryBossBean] Received inventory report from RHQ Agent [Agent[id=501050,name=dhcp231-18.rdu.redhat.com,address=10.11.231.18,port=16163,remote-endpoint=socket://10.11.231.18:16163/?rhq.communications.connector.rhqtype=agent&numAcceptThreads=1&maxPoolSize=303&clientMaxPoolSize=304&socketTimeout=60000&enableTcpNoDelay=true&backlog=200,last-availability-report=1223400793682]]. Number of added roots: 0 No repetitive logging.
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-922