Description of problem:
ConfigurationManagerBean.deleteConfigurations(List<Integer> configIds) is not coded properly.
It executes "Configuration.QUERY_DELETE_PROPERTIES_BY_CONFIGURATION_IDS" query twice, which was a copy/paste error introduced in Dec 2008 as part of the fix for https://bugzilla.redhat.com/show_bug.cgi?id=RHQ-1260
Version-Release number of selected component (if applicable):
1.2.0 -> 1.3.1
Steps to Reproduce:
1a. Go to /admin/test/hibernate.jsp
1b. Execute "select count(c) from Configuration c", record the count
1c. Execute "select count(p) from Property p", record the count
2. Execute an operation (on any resource) that has either arguments, or results, or both
3. Wait until the operation completes
4. Delete the corresponding operation history entry
5. Repeat the steps in 1a/1b/1c, and records both counts again
The second set of counts is higher, indicating that the configuration/property objects are not being properly expunged.
The configuration counts should be the same before and after the operation execution and deletion of the audit trail record. The property counts should be the same before and after the operation execution and deletion of the audit trail record.
fix broken ConfigurationManagerBean.deleteConfigurations(List<Integer> configIds) method:
* no longer need to explicitly delete properties, they are cascade deleted at the DB-level
* fix typo to change configurationsQuery to use Configuration.QUERY_DELETE_CONFIGURATIONS_BY_CONFIGURATION_IDS
* add new query to break property recursion for DBs that don't support self-referencing cascading
** this means that nested (non-top-level) properties will be orphaned on MSSQL, which doesn't support that recursive cascade
* finally, needed to clean out RawConfiguration objects along with the delete
Returning this one to dev. I don't think configuration and property counts are giving us the right results.
run #1 - recent hudson build, reasonably heavy inventory, postgres
* executed 'select count(c) from Configuration c' = 3937
* executed 'select count(p) from Property p' = 46267
* ran autodiscovery op with "yes" as the detailed results parameter.
* deleted op history
* executed 'select count(c) from Configuration c' = 3938
* select 'count(p) from Property p' = 46268
run #2 - proposed beta build, light inventory, postgres
platform: autodiscovery / yes
run #3 - same config as above, but deleted all op history prior to run.
platform: audodiscovery / yes
deleted op history
run #4 - same config as run #3; performing different op w/ param
apache: install mod_jk configuration with "Yes" as the parameter
It's known that not all Config entries get cleaned up. The work to do complete cleaning is too high.