[rhq] Branch 'hotfix/jon3.0.0' - modules/core
by Larry O'Leary
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 170 ++++++++--
1 file changed, 143 insertions(+), 27 deletions(-)
New commits:
commit 85320d205cc3f0e3ea7eaa2fc4ef0ce149900039
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 15:05:24 2012 -0500
[Bug 785022 - Server upgrade fails if db-uprade.xml task is unable to created index when index already exists]
Applying suggested fix from loleary. Could not apply patch successfully
so manually reapplied the fix, which is to protect create/drop index
stmts with ignoreErrors="true".
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index fb2ed85..c6f1bc6 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -296,7 +296,7 @@
</schema-directSQL>
<schema-alterColumn table="RHQ_SERVER" column="OPERATION_MODE" nullable="FALSE" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_SERVER unique constraint on NAME">
CREATE UNIQUE INDEX rhq_server_name_unique ON rhq_server (name)
</statement>
@@ -853,7 +853,7 @@
</schemaSpec>
<schemaSpec version="2.24">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_MEASUREMENT_BLINE index on SCHEDULE_ID">
CREATE INDEX rhq_meas_baseline_sid_idx ON rhq_measurement_bline (schedule_id)
</statement>
@@ -1078,7 +1078,7 @@
</schemaSpec>
<schemaSpec version="2.36">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique constraint on RHQ_MEASUREMENT_DEF">
DROP INDEX RHQ_METRIC_DEF_KEY_IDX
</statement>
@@ -1093,7 +1093,7 @@
WHERE NUMERIC_TYPE = 0
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RHQ_MEASUREMENT_DEF (RESOURCE_TYPE_ID, NAME, RAW_NUMERIC_TYPE)">
CREATE UNIQUE INDEX RHQ_METRIC_DEF_KEY_IDX ON RHQ_MEASUREMENT_DEF (RESOURCE_TYPE_ID, NAME, RAW_NUMERIC_TYPE)
</statement>
@@ -1193,49 +1193,77 @@
<!-- RHQ 1448 -->
<schemaSpec version="2.44">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R00 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R00_SID_IDX ON RHQ_MEAS_DATA_NUM_R00 (schedule_id)
- </statement>
+ </statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R01 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R01_SID_IDX ON RHQ_MEAS_DATA_NUM_R01 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R02 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R02_SID_IDX ON RHQ_MEAS_DATA_NUM_R02 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R03 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R03_SID_IDX ON RHQ_MEAS_DATA_NUM_R03 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R04 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R04_SID_IDX ON RHQ_MEAS_DATA_NUM_R04 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R05 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R05_SID_IDX ON RHQ_MEAS_DATA_NUM_R05 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R06 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R06_SID_IDX ON RHQ_MEAS_DATA_NUM_R06 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R07 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R07_SID_IDX ON RHQ_MEAS_DATA_NUM_R07 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R08 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R08_SID_IDX ON RHQ_MEAS_DATA_NUM_R08 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R09 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R09_SID_IDX ON RHQ_MEAS_DATA_NUM_R09 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R10 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R10_SID_IDX ON RHQ_MEAS_DATA_NUM_R10 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R11 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R11_SID_IDX ON RHQ_MEAS_DATA_NUM_R11 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R12 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R12_SID_IDX ON RHQ_MEAS_DATA_NUM_R12 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R13 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R13_SID_IDX ON RHQ_MEAS_DATA_NUM_R13 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R14 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R14_SID_IDX ON RHQ_MEAS_DATA_NUM_R14 (schedule_id)
</statement>
@@ -1300,7 +1328,7 @@
</schemaSpec>
<schemaSpec version="2.50">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_RESOURCE_ERROR.RESOURCE_ID">
CREATE INDEX RHQ_RES_ERROR_IDX_RES_ID ON RHQ_RESOURCE_ERROR (RESOURCE_ID)
</statement>
@@ -1313,12 +1341,12 @@
</schemaSpec>
<schemaSpec version="2.52">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique name constraint on RHQ_RESOURCE_GROUP">
DROP INDEX RHQ_RES_GROUP_NAME
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique name constraint on RHQ_RESOURCE_GROUP">
CREATE INDEX RHQ_RES_GROUP_NAME ON RHQ_RESOURCE_GROUP (name)
</statement>
@@ -1348,57 +1376,87 @@
</schemaSpec>
<schemaSpec version="2.55">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on TIME_STAMP column of RHQ_MEASUREMENT_DATA_NUM_1H">
CREATE INDEX RHQ_MEAS_DATA_1H_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_1H(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on TIME_STAMP column of RHQ_MEASUREMENT_DATA_NUM_6H">
CREATE INDEX RHQ_MEAS_DATA_6H_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_6H(TIME_STAMP)
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R00 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R00_TS_IDX ON RHQ_MEAS_DATA_NUM_R00 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R01 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R01_TS_IDX ON RHQ_MEAS_DATA_NUM_R01 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R02 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R02_TS_IDX ON RHQ_MEAS_DATA_NUM_R02 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R03 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R03_TS_IDX ON RHQ_MEAS_DATA_NUM_R03 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R04 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R04_TS_IDX ON RHQ_MEAS_DATA_NUM_R04 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R05 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R05_TS_IDX ON RHQ_MEAS_DATA_NUM_R05 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R06 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R06_TS_IDX ON RHQ_MEAS_DATA_NUM_R06 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R07 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R07_TS_IDX ON RHQ_MEAS_DATA_NUM_R07 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R08 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R08_TS_IDX ON RHQ_MEAS_DATA_NUM_R08 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R09 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R09_TS_IDX ON RHQ_MEAS_DATA_NUM_R09 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R10 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R10_TS_IDX ON RHQ_MEAS_DATA_NUM_R10 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R11 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R11_TS_IDX ON RHQ_MEAS_DATA_NUM_R11 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R12 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R12_TS_IDX ON RHQ_MEAS_DATA_NUM_R12 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R13 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R13_TS_IDX ON RHQ_MEAS_DATA_NUM_R13 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R14 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R14_TS_IDX ON RHQ_MEAS_DATA_NUM_R14 (TIME_STAMP)
</statement>
@@ -1406,49 +1464,77 @@
</schemaSpec>
<schemaSpec version="2.56">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R00_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R00_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R01_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R01_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R02_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R02_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R03_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R03_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R04_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R04_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R05_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R05_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R06_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R06_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R07_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R07_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R08_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R08_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R09_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R09_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R10_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R10_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R11_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R11_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R12_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R12_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R13_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R13_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R14_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R14_SID_IDX
</statement>
@@ -1456,7 +1542,7 @@
</schemaSpec>
<schemaSpec version="2.57">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Create index on RHQ_CONFIG_PROPERTY(PARENT_LIST_ID)">
CREATE INDEX RHQ_CONFIG_PROP_idx_list_key ON RHQ_CONFIG_PROPERTY(PARENT_LIST_ID)
</statement>
@@ -1683,6 +1769,8 @@
FOREIGN KEY ( REPO_GROUP_TYPE_ID )
REFERENCES RHQ_REPO_GROUP_TYPE ( ID )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_REPO_GROUP_IDX
ON RHQ_REPO_GROUP ( NAME, REPO_GROUP_TYPE_ID )
@@ -1842,7 +1930,7 @@
<schema-alterColumn table="RHQ_DISTRIBUTION" column="BASE_PATH" nullable="false" />
<schema-addColumn table="RHQ_DISTRIBUTION" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_DISTRIBUTION" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_DISTRIBUTION_IDX ON RHQ_DISTRIBUTION ( LABEL, BASE_PATH )
</statement>
@@ -1947,6 +2035,8 @@
FOREIGN KEY (DISTRIBUTION_ID)
REFERENCES RHQ_DISTRIBUTION ( ID )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_DISTRIBUTION_FILE_IDX
ON RHQ_DISTRIBUTION_FILE ( DISTRIBUTION_ID, RELATIVE_FILENAME )
@@ -2019,7 +2109,7 @@
</schema-directSQL>
<!-- Fix bug:538157 -->
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE INDEX RHQ_REPO_PKG_VER_MAP_IDX
ON RHQ_REPO_PKG_VERSION_MAP ( PACKAGE_VERSION_ID )
@@ -2040,10 +2130,12 @@
<schemaSpec version="2.69.2">
<!-- plugin names must be unique only if they are deployed on the same side (agent vs. server) -->
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping unique index on RHQ_PLUGIN (NAME)">
DROP INDEX RHQ_PLUGIN_NAME_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RHQ_PLUGIN (NAME, DEPLOYMENT) so server plugin names need not be unique with agent plugins">
CREATE UNIQUE INDEX RHQ_PLUGIN_NAME_DEPLOY_IDX ON RHQ_PLUGIN (NAME, DEPLOYMENT)
</statement>
@@ -2086,7 +2178,7 @@
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="MESSAGE" columnType="VARCHAR2" precision="4000" />
</schemaSpec>
<schemaSpec version="2.70.3">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping unique index RHQ_ALERT_IDX_ALERT">
DROP INDEX RHQ_ALERT_IDX_ALERT
</statement>
@@ -2127,7 +2219,7 @@
<schema-deleteColumn table="RHQ_ALERT" column="triggered_operation" />
</schemaSpec>
<schemaSpec version="2.70.7">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Recreating RHQ_ALERT_IDX_ALERT as non-unique index">
CREATE INDEX RHQ_ALERT_IDX_ALERT ON RHQ_ALERT_NOTIF_LOG (alert_id)
</statement>
@@ -2168,13 +2260,17 @@
<schema-addColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ ON RHQ_ADVISORY ( ADVISORY_NAME )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_UQ ON RHQ_ADVISORY ( ADVISORY )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE INDEX RHQ_ADVISORY_UDATE_IDX ON RHQ_ADVISORY (UPDATE_DATE )
</statement>
@@ -2193,7 +2289,7 @@
<schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="PACKAGE_VERSION_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_PACKAGE_IDX ON RHQ_ADVISORY_PACKAGE ( ADVISORY_ID, PACKAGE_VERSION_ID )
</statement>
@@ -2234,7 +2330,7 @@
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="CVE_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_CVE_IDX ON RHQ_ADVISORY_CVE ( ADVISORY_ID, CVE_ID )
</statement>
@@ -2266,7 +2362,7 @@
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_BUG_IDX ON RHQ_ADVISORY_BUGLIST ( ADVISORY_ID, BUG_ID )
</statement>
@@ -2365,6 +2461,8 @@
FOREIGN KEY (RESOURCE_TYPE_ID)
REFERENCES RHQ_RESOURCE_TYPE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_TYPE unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_TYPE_UNIQUE ON RHQ_BUNDLE_TYPE (name)
</statement>
@@ -2406,6 +2504,8 @@
FOREIGN KEY (PACKAGE_TYPE_ID)
REFERENCES RHQ_PACKAGE_TYPE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_UNIQUE ON RHQ_BUNDLE (bundle_type_id, name)
</statement>
@@ -2444,6 +2544,8 @@
FOREIGN KEY (CONFIG_DEF_ID)
REFERENCES RHQ_CONFIG_DEF (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_VERSION unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_VERSION_UNIQUE ON RHQ_BUNDLE_VERSION (bundle_id, name, version)
</statement>
@@ -2539,6 +2641,8 @@
FOREIGN KEY (GROUP_ID)
REFERENCES RHQ_RESOURCE_GROUP (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_DESTINATION unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_DESTINATION_UNIQUE
ON RHQ_BUNDLE_DESTINATION (bundle_id, group_id, deploy_dir)
@@ -2630,6 +2734,8 @@
FOREIGN KEY (RESOURCE_ID)
REFERENCES RHQ_RESOURCE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_RES_DEPLOY unique constraint on dep-resource mapping">
CREATE UNIQUE INDEX RHQ_BUNDLE_RES_DEPLOY_IDX
ON RHQ_BUNDLE_RES_DEPLOY (BUNDLE_DEPLOYMENT_ID, RESOURCE_ID)
@@ -2788,6 +2894,8 @@
FOREIGN KEY ( ROLE_ID )
REFERENCES RHQ_ROLE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ROLE_LDAP_GROUP_IDX
ON RHQ_ROLE_LDAP_GROUP ( ROLE_ID, LDAP_GROUP_NAME )
@@ -2996,10 +3104,12 @@
</schemaSpec>
<schemaSpec version="2.87">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Drop non-unique RHQ_RES_TYPE_IDX_PLG_NAME index">
DROP INDEX RHQ_RES_TYPE_IDX_PLG_NAME
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Recreate RHQ_RES_TYPE_IDX_PLG_NAME index as unique">
CREATE UNIQUE INDEX RHQ_RES_TYPE_IDX_PLG_NAME ON RHQ_RESOURCE_TYPE (name, plugin)
</statement>
@@ -3007,10 +3117,12 @@
</schemaSpec>
<schemaSpec version="2.88">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add end time index on call time data to speed up purges">
CREATE INDEX RHQ_CT_DA_VA_END_TIM_IDX ON RHQ_CALLTIME_DATA_VALUE (end_time)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add index on measurement definition numeric type">
CREATE INDEX RHQ_METRIC_DEF_NT_IDX ON RHQ_MEASUREMENT_DEF (numeric_type)
</statement>
@@ -3131,7 +3243,7 @@
</schemaSpec>
<schemaSpec version="2.92.4">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add index on measurement data 1d table timestamp">
CREATE INDEX RHQ_MEAS_DATA_1D_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_1D (time_stamp)
</statement>
@@ -3294,6 +3406,8 @@
<statement desc="Changing primary key of RHQ_OPERATION_SCHEDULE to ID. Step2/3...">
ALTER TABLE RHQ_OPERATION_SCHEDULE ADD PRIMARY KEY (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Changing primary key of RHQ_OPERATION_SCHEDULE to ID. Step3/3...">
CREATE UNIQUE INDEX RHQ_OPERATION_SCHEDULE_KEY_IDX ON RHQ_OPERATION_SCHEDULE (JOB_NAME, JOB_GROUP)
</statement>
@@ -3607,10 +3721,12 @@
</schemaSpec>
<schemaSpec version="2.113">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_ALERT_CONDITION_LOG index on CONDITION_ID">
CREATE INDEX RHQ_ALERT_COND_LOG_COND_IDX ON RHQ_ALERT_CONDITION_LOG (CONDITION_ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_MEASUREMENT_SCHED index on RESOURCE_ID">
CREATE INDEX RHQ_MEAS_SCHED_RESID_IDX ON RHQ_MEASUREMENT_SCHED (RESOURCE_ID)
</statement>
@@ -3667,7 +3783,7 @@
REFERENCES RHQ_CONFIG (ID)
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RESOURCE_TYPE_ID and NAME columns">
CREATE UNIQUE INDEX RHQ_TYPE_DEF_NAME ON RHQ_DRIFT_DEF_TEMPLATE ( RESOURCE_TYPE_ID, NAME )
</statement>
12 years, 4 months
[rhq] Branch 'release/jon3.0.x' - modules/core
by Jay Shaughnessy
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java | 60 +++++-----
1 file changed, 35 insertions(+), 25 deletions(-)
New commits:
commit d44638c22a94b4997fd3a5af9f27b642bed97ef0
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 15:20:14 2012 -0500
[Bug 773435 - Enabled event sources cause initial resource component start to time out]
lazily access sigar on the first polling, which happens after container
initialization.
Conflicts:
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
index bcc42de..30cd3e5 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
@@ -46,28 +46,21 @@ import org.rhq.core.pluginapi.event.EventPoller;
*
* @author Ian Springer
*/
-public class LogFileEventPoller implements EventPoller {
+public class LogFileEventPoller implements EventPoller {
private final Log log = LogFactory.getLog(this.getClass());
private String eventType;
private File logFile;
private FileInfo logFileInfo;
private LogEntryProcessor entryProcessor;
+ private EventContext eventContext;
- public LogFileEventPoller(EventContext eventContext, String eventType, File logFile, LogEntryProcessor entryProcessor) {
- SigarProxy sigar = eventContext.getSigar();
+ public LogFileEventPoller(EventContext eventContext, String eventType, File logFile,
+ LogEntryProcessor entryProcessor) {
this.eventType = eventType;
this.logFile = logFile;
- if (sigar != null) {
- try {
- this.logFileInfo = new LogFileInfo(sigar.getFileInfo(logFile.getPath()));
- } catch (SigarException e) {
- throw new RuntimeException("Failed to obtain file info for log file [" + this.logFile + "].", e);
- }
- } else {
- log.warn("SIGAR is unavailable - cannot poll log file [" + this.logFile + "] for events.");
- }
this.entryProcessor = entryProcessor;
+ this.eventContext = eventContext;
}
@NotNull
@@ -80,11 +73,26 @@ public class LogFileEventPoller implements EventPoller {
return this.logFile.getPath();
}
+ // we can't get the FileInfo in the constructor because pollers are constructed during pc initialization, and
+ // at that time the eventManager is not available (and so we can't get sigar).
+ private FileInfo getFileInfo() {
+ if (null == this.logFileInfo) {
+ try {
+ SigarProxy sigar = eventContext.getSigar();
+ this.logFileInfo = new LogFileInfo(sigar.getFileInfo(logFile.getPath()));
+ // once we have the file info we can let go of the event context, just in case that's useful
+ this.eventContext = null;
+
+ } catch (SigarException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return this.logFileInfo;
+ }
+
@Nullable
public Set<Event> poll() {
- if (this.logFileInfo == null) {
- return null;
- }
if (!this.logFile.exists()) {
log.warn("Log file [" + this.logFile + "] being polled does not exist.");
return null;
@@ -93,23 +101,25 @@ public class LogFileEventPoller implements EventPoller {
log.error("Log file [" + this.logFile + "] being polled is a directory, not a regular file.");
return null;
}
+ FileInfo fileInfo;
try {
- if (!this.logFileInfo.changed()) {
+ fileInfo = getFileInfo();
+ if (!fileInfo.changed()) {
return null;
}
} catch (SigarException e) {
throw new RuntimeException(e);
}
- return processNewLines();
+ return processNewLines(fileInfo);
}
- private Set<Event> processNewLines() {
+ private Set<Event> processNewLines(FileInfo fileInfo) {
Set<Event> events = null;
Reader reader = null;
try {
reader = new FileReader(this.logFile);
- long offset = getOffset();
+ long offset = getOffset(fileInfo);
if (offset > 0) {
reader.skip(offset);
@@ -130,24 +140,24 @@ public class LogFileEventPoller implements EventPoller {
return events;
}
- private long getOffset() {
- FileInfo previousFileInfo = this.logFileInfo.getPreviousInfo();
+ private long getOffset(FileInfo fileInfo) {
+ FileInfo previousFileInfo = fileInfo.getPreviousInfo();
if (previousFileInfo == null) {
if (log.isDebugEnabled()) {
log.debug(this.logFile + ": first stat");
}
- return this.logFileInfo.getSize();
+ return fileInfo.getSize();
}
- if (this.logFileInfo.getInode() != previousFileInfo.getInode()) {
+ if (fileInfo.getInode() != previousFileInfo.getInode()) {
if (log.isDebugEnabled()) {
log.debug(this.logFile + ": file inode changed");
}
return -1;
}
- if (this.logFileInfo.getSize() < previousFileInfo.getSize()) {
+ if (fileInfo.getSize() < previousFileInfo.getSize()) {
if (log.isDebugEnabled()) {
log.debug(this.logFile + ": file truncated");
}
@@ -155,7 +165,7 @@ public class LogFileEventPoller implements EventPoller {
}
if (log.isDebugEnabled()) {
- long diff = this.logFileInfo.getSize() - previousFileInfo.getSize();
+ long diff = fileInfo.getSize() - previousFileInfo.getSize();
log.debug(this.logFile + ": " + diff + " new bytes");
}
12 years, 4 months
[rhq] Branch 'release/jon3.0.x' - modules/core
by Jay Shaughnessy
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 170 ++++++++--
1 file changed, 143 insertions(+), 27 deletions(-)
New commits:
commit db02533c122d00f11bcfdda3531db5567558a144
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 15:05:24 2012 -0500
[Bug 785022 - Server upgrade fails if db-uprade.xml task is unable to created index when index already exists]
Applying suggested fix from loleary. Could not apply patch successfully
so manually reapplied the fix, which is to protect create/drop index
stmts with ignoreErrors="true".
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 7dd68d4..2ffdfe5 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -296,7 +296,7 @@
</schema-directSQL>
<schema-alterColumn table="RHQ_SERVER" column="OPERATION_MODE" nullable="FALSE" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_SERVER unique constraint on NAME">
CREATE UNIQUE INDEX rhq_server_name_unique ON rhq_server (name)
</statement>
@@ -853,7 +853,7 @@
</schemaSpec>
<schemaSpec version="2.24">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_MEASUREMENT_BLINE index on SCHEDULE_ID">
CREATE INDEX rhq_meas_baseline_sid_idx ON rhq_measurement_bline (schedule_id)
</statement>
@@ -1078,7 +1078,7 @@
</schemaSpec>
<schemaSpec version="2.36">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique constraint on RHQ_MEASUREMENT_DEF">
DROP INDEX RHQ_METRIC_DEF_KEY_IDX
</statement>
@@ -1093,7 +1093,7 @@
WHERE NUMERIC_TYPE = 0
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RHQ_MEASUREMENT_DEF (RESOURCE_TYPE_ID, NAME, RAW_NUMERIC_TYPE)">
CREATE UNIQUE INDEX RHQ_METRIC_DEF_KEY_IDX ON RHQ_MEASUREMENT_DEF (RESOURCE_TYPE_ID, NAME, RAW_NUMERIC_TYPE)
</statement>
@@ -1193,49 +1193,77 @@
<!-- RHQ 1448 -->
<schemaSpec version="2.44">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R00 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R00_SID_IDX ON RHQ_MEAS_DATA_NUM_R00 (schedule_id)
- </statement>
+ </statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R01 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R01_SID_IDX ON RHQ_MEAS_DATA_NUM_R01 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R02 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R02_SID_IDX ON RHQ_MEAS_DATA_NUM_R02 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R03 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R03_SID_IDX ON RHQ_MEAS_DATA_NUM_R03 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R04 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R04_SID_IDX ON RHQ_MEAS_DATA_NUM_R04 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R05 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R05_SID_IDX ON RHQ_MEAS_DATA_NUM_R05 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R06 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R06_SID_IDX ON RHQ_MEAS_DATA_NUM_R06 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R07 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R07_SID_IDX ON RHQ_MEAS_DATA_NUM_R07 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R08 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R08_SID_IDX ON RHQ_MEAS_DATA_NUM_R08 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R09 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R09_SID_IDX ON RHQ_MEAS_DATA_NUM_R09 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R10 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R10_SID_IDX ON RHQ_MEAS_DATA_NUM_R10 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R11 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R11_SID_IDX ON RHQ_MEAS_DATA_NUM_R11 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R12 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R12_SID_IDX ON RHQ_MEAS_DATA_NUM_R12 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R13 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R13_SID_IDX ON RHQ_MEAS_DATA_NUM_R13 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R14 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R14_SID_IDX ON RHQ_MEAS_DATA_NUM_R14 (schedule_id)
</statement>
@@ -1300,7 +1328,7 @@
</schemaSpec>
<schemaSpec version="2.50">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_RESOURCE_ERROR.RESOURCE_ID">
CREATE INDEX RHQ_RES_ERROR_IDX_RES_ID ON RHQ_RESOURCE_ERROR (RESOURCE_ID)
</statement>
@@ -1313,12 +1341,12 @@
</schemaSpec>
<schemaSpec version="2.52">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique name constraint on RHQ_RESOURCE_GROUP">
DROP INDEX RHQ_RES_GROUP_NAME
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique name constraint on RHQ_RESOURCE_GROUP">
CREATE INDEX RHQ_RES_GROUP_NAME ON RHQ_RESOURCE_GROUP (name)
</statement>
@@ -1348,57 +1376,87 @@
</schemaSpec>
<schemaSpec version="2.55">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on TIME_STAMP column of RHQ_MEASUREMENT_DATA_NUM_1H">
CREATE INDEX RHQ_MEAS_DATA_1H_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_1H(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on TIME_STAMP column of RHQ_MEASUREMENT_DATA_NUM_6H">
CREATE INDEX RHQ_MEAS_DATA_6H_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_6H(TIME_STAMP)
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R00 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R00_TS_IDX ON RHQ_MEAS_DATA_NUM_R00 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R01 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R01_TS_IDX ON RHQ_MEAS_DATA_NUM_R01 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R02 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R02_TS_IDX ON RHQ_MEAS_DATA_NUM_R02 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R03 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R03_TS_IDX ON RHQ_MEAS_DATA_NUM_R03 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R04 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R04_TS_IDX ON RHQ_MEAS_DATA_NUM_R04 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R05 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R05_TS_IDX ON RHQ_MEAS_DATA_NUM_R05 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R06 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R06_TS_IDX ON RHQ_MEAS_DATA_NUM_R06 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R07 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R07_TS_IDX ON RHQ_MEAS_DATA_NUM_R07 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R08 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R08_TS_IDX ON RHQ_MEAS_DATA_NUM_R08 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R09 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R09_TS_IDX ON RHQ_MEAS_DATA_NUM_R09 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R10 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R10_TS_IDX ON RHQ_MEAS_DATA_NUM_R10 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R11 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R11_TS_IDX ON RHQ_MEAS_DATA_NUM_R11 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R12 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R12_TS_IDX ON RHQ_MEAS_DATA_NUM_R12 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R13 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R13_TS_IDX ON RHQ_MEAS_DATA_NUM_R13 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R14 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R14_TS_IDX ON RHQ_MEAS_DATA_NUM_R14 (TIME_STAMP)
</statement>
@@ -1406,49 +1464,77 @@
</schemaSpec>
<schemaSpec version="2.56">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R00_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R00_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R01_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R01_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R02_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R02_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R03_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R03_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R04_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R04_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R05_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R05_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R06_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R06_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R07_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R07_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R08_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R08_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R09_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R09_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R10_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R10_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R11_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R11_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R12_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R12_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R13_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R13_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R14_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R14_SID_IDX
</statement>
@@ -1456,7 +1542,7 @@
</schemaSpec>
<schemaSpec version="2.57">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Create index on RHQ_CONFIG_PROPERTY(PARENT_LIST_ID)">
CREATE INDEX RHQ_CONFIG_PROP_idx_list_key ON RHQ_CONFIG_PROPERTY(PARENT_LIST_ID)
</statement>
@@ -1683,6 +1769,8 @@
FOREIGN KEY ( REPO_GROUP_TYPE_ID )
REFERENCES RHQ_REPO_GROUP_TYPE ( ID )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_REPO_GROUP_IDX
ON RHQ_REPO_GROUP ( NAME, REPO_GROUP_TYPE_ID )
@@ -1842,7 +1930,7 @@
<schema-alterColumn table="RHQ_DISTRIBUTION" column="BASE_PATH" nullable="false" />
<schema-addColumn table="RHQ_DISTRIBUTION" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_DISTRIBUTION" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_DISTRIBUTION_IDX ON RHQ_DISTRIBUTION ( LABEL, BASE_PATH )
</statement>
@@ -1947,6 +2035,8 @@
FOREIGN KEY (DISTRIBUTION_ID)
REFERENCES RHQ_DISTRIBUTION ( ID )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_DISTRIBUTION_FILE_IDX
ON RHQ_DISTRIBUTION_FILE ( DISTRIBUTION_ID, RELATIVE_FILENAME )
@@ -2019,7 +2109,7 @@
</schema-directSQL>
<!-- Fix bug:538157 -->
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE INDEX RHQ_REPO_PKG_VER_MAP_IDX
ON RHQ_REPO_PKG_VERSION_MAP ( PACKAGE_VERSION_ID )
@@ -2040,10 +2130,12 @@
<schemaSpec version="2.69.2">
<!-- plugin names must be unique only if they are deployed on the same side (agent vs. server) -->
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping unique index on RHQ_PLUGIN (NAME)">
DROP INDEX RHQ_PLUGIN_NAME_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RHQ_PLUGIN (NAME, DEPLOYMENT) so server plugin names need not be unique with agent plugins">
CREATE UNIQUE INDEX RHQ_PLUGIN_NAME_DEPLOY_IDX ON RHQ_PLUGIN (NAME, DEPLOYMENT)
</statement>
@@ -2086,7 +2178,7 @@
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="MESSAGE" columnType="VARCHAR2" precision="4000" />
</schemaSpec>
<schemaSpec version="2.70.3">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping unique index RHQ_ALERT_IDX_ALERT">
DROP INDEX RHQ_ALERT_IDX_ALERT
</statement>
@@ -2127,7 +2219,7 @@
<schema-deleteColumn table="RHQ_ALERT" column="triggered_operation" />
</schemaSpec>
<schemaSpec version="2.70.7">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Recreating RHQ_ALERT_IDX_ALERT as non-unique index">
CREATE INDEX RHQ_ALERT_IDX_ALERT ON RHQ_ALERT_NOTIF_LOG (alert_id)
</statement>
@@ -2168,13 +2260,17 @@
<schema-addColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ ON RHQ_ADVISORY ( ADVISORY_NAME )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_UQ ON RHQ_ADVISORY ( ADVISORY )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE INDEX RHQ_ADVISORY_UDATE_IDX ON RHQ_ADVISORY (UPDATE_DATE )
</statement>
@@ -2193,7 +2289,7 @@
<schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="PACKAGE_VERSION_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_PACKAGE_IDX ON RHQ_ADVISORY_PACKAGE ( ADVISORY_ID, PACKAGE_VERSION_ID )
</statement>
@@ -2234,7 +2330,7 @@
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="CVE_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_CVE_IDX ON RHQ_ADVISORY_CVE ( ADVISORY_ID, CVE_ID )
</statement>
@@ -2266,7 +2362,7 @@
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_BUG_IDX ON RHQ_ADVISORY_BUGLIST ( ADVISORY_ID, BUG_ID )
</statement>
@@ -2365,6 +2461,8 @@
FOREIGN KEY (RESOURCE_TYPE_ID)
REFERENCES RHQ_RESOURCE_TYPE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_TYPE unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_TYPE_UNIQUE ON RHQ_BUNDLE_TYPE (name)
</statement>
@@ -2406,6 +2504,8 @@
FOREIGN KEY (PACKAGE_TYPE_ID)
REFERENCES RHQ_PACKAGE_TYPE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_UNIQUE ON RHQ_BUNDLE (bundle_type_id, name)
</statement>
@@ -2444,6 +2544,8 @@
FOREIGN KEY (CONFIG_DEF_ID)
REFERENCES RHQ_CONFIG_DEF (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_VERSION unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_VERSION_UNIQUE ON RHQ_BUNDLE_VERSION (bundle_id, name, version)
</statement>
@@ -2539,6 +2641,8 @@
FOREIGN KEY (GROUP_ID)
REFERENCES RHQ_RESOURCE_GROUP (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_DESTINATION unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_DESTINATION_UNIQUE
ON RHQ_BUNDLE_DESTINATION (bundle_id, group_id, deploy_dir)
@@ -2630,6 +2734,8 @@
FOREIGN KEY (RESOURCE_ID)
REFERENCES RHQ_RESOURCE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_RES_DEPLOY unique constraint on dep-resource mapping">
CREATE UNIQUE INDEX RHQ_BUNDLE_RES_DEPLOY_IDX
ON RHQ_BUNDLE_RES_DEPLOY (BUNDLE_DEPLOYMENT_ID, RESOURCE_ID)
@@ -2788,6 +2894,8 @@
FOREIGN KEY ( ROLE_ID )
REFERENCES RHQ_ROLE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ROLE_LDAP_GROUP_IDX
ON RHQ_ROLE_LDAP_GROUP ( ROLE_ID, LDAP_GROUP_NAME )
@@ -2996,10 +3104,12 @@
</schemaSpec>
<schemaSpec version="2.87">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Drop non-unique RHQ_RES_TYPE_IDX_PLG_NAME index">
DROP INDEX RHQ_RES_TYPE_IDX_PLG_NAME
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Recreate RHQ_RES_TYPE_IDX_PLG_NAME index as unique">
CREATE UNIQUE INDEX RHQ_RES_TYPE_IDX_PLG_NAME ON RHQ_RESOURCE_TYPE (name, plugin)
</statement>
@@ -3007,10 +3117,12 @@
</schemaSpec>
<schemaSpec version="2.88">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add end time index on call time data to speed up purges">
CREATE INDEX RHQ_CT_DA_VA_END_TIM_IDX ON RHQ_CALLTIME_DATA_VALUE (end_time)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add index on measurement definition numeric type">
CREATE INDEX RHQ_METRIC_DEF_NT_IDX ON RHQ_MEASUREMENT_DEF (numeric_type)
</statement>
@@ -3131,7 +3243,7 @@
</schemaSpec>
<schemaSpec version="2.92.4">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add index on measurement data 1d table timestamp">
CREATE INDEX RHQ_MEAS_DATA_1D_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_1D (time_stamp)
</statement>
@@ -3294,6 +3406,8 @@
<statement desc="Changing primary key of RHQ_OPERATION_SCHEDULE to ID. Step2/3...">
ALTER TABLE RHQ_OPERATION_SCHEDULE ADD PRIMARY KEY (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Changing primary key of RHQ_OPERATION_SCHEDULE to ID. Step3/3...">
CREATE UNIQUE INDEX RHQ_OPERATION_SCHEDULE_KEY_IDX ON RHQ_OPERATION_SCHEDULE (JOB_NAME, JOB_GROUP)
</statement>
@@ -3607,10 +3721,12 @@
</schemaSpec>
<schemaSpec version="2.113">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_ALERT_CONDITION_LOG index on CONDITION_ID">
CREATE INDEX RHQ_ALERT_COND_LOG_COND_IDX ON RHQ_ALERT_CONDITION_LOG (CONDITION_ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_MEASUREMENT_SCHED index on RESOURCE_ID">
CREATE INDEX RHQ_MEAS_SCHED_RESID_IDX ON RHQ_MEASUREMENT_SCHED (RESOURCE_ID)
</statement>
@@ -3667,7 +3783,7 @@
REFERENCES RHQ_CONFIG (ID)
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RESOURCE_TYPE_ID and NAME columns">
CREATE UNIQUE INDEX RHQ_TYPE_DEF_NAME ON RHQ_DRIFT_DEF_TEMPLATE ( RESOURCE_TYPE_ID, NAME )
</statement>
12 years, 4 months
[rhq] modules/core
by Jay Shaughnessy
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 170 ++++++++--
1 file changed, 143 insertions(+), 27 deletions(-)
New commits:
commit 3ae6a9600f01eb0fad0f52b61277d9cbb31e5479
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 15:05:24 2012 -0500
[Bug 785022 - Server upgrade fails if db-uprade.xml task is unable to created index when index already exists]
Applying suggested fix from loleary. Could not apply patch successfully
so manually reapplied the fix, which is to protect create/drop index
stmts with ignoreErrors="true".
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index c9b0bea..7b1f9a2 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -296,7 +296,7 @@
</schema-directSQL>
<schema-alterColumn table="RHQ_SERVER" column="OPERATION_MODE" nullable="FALSE" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_SERVER unique constraint on NAME">
CREATE UNIQUE INDEX rhq_server_name_unique ON rhq_server (name)
</statement>
@@ -853,7 +853,7 @@
</schemaSpec>
<schemaSpec version="2.24">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_MEASUREMENT_BLINE index on SCHEDULE_ID">
CREATE INDEX rhq_meas_baseline_sid_idx ON rhq_measurement_bline (schedule_id)
</statement>
@@ -1078,7 +1078,7 @@
</schemaSpec>
<schemaSpec version="2.36">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique constraint on RHQ_MEASUREMENT_DEF">
DROP INDEX RHQ_METRIC_DEF_KEY_IDX
</statement>
@@ -1093,7 +1093,7 @@
WHERE NUMERIC_TYPE = 0
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RHQ_MEASUREMENT_DEF (RESOURCE_TYPE_ID, NAME, RAW_NUMERIC_TYPE)">
CREATE UNIQUE INDEX RHQ_METRIC_DEF_KEY_IDX ON RHQ_MEASUREMENT_DEF (RESOURCE_TYPE_ID, NAME, RAW_NUMERIC_TYPE)
</statement>
@@ -1193,49 +1193,77 @@
<!-- RHQ 1448 -->
<schemaSpec version="2.44">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R00 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R00_SID_IDX ON RHQ_MEAS_DATA_NUM_R00 (schedule_id)
- </statement>
+ </statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R01 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R01_SID_IDX ON RHQ_MEAS_DATA_NUM_R01 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R02 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R02_SID_IDX ON RHQ_MEAS_DATA_NUM_R02 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R03 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R03_SID_IDX ON RHQ_MEAS_DATA_NUM_R03 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R04 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R04_SID_IDX ON RHQ_MEAS_DATA_NUM_R04 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R05 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R05_SID_IDX ON RHQ_MEAS_DATA_NUM_R05 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R06 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R06_SID_IDX ON RHQ_MEAS_DATA_NUM_R06 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R07 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R07_SID_IDX ON RHQ_MEAS_DATA_NUM_R07 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R08 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R08_SID_IDX ON RHQ_MEAS_DATA_NUM_R08 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R09 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R09_SID_IDX ON RHQ_MEAS_DATA_NUM_R09 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R10 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R10_SID_IDX ON RHQ_MEAS_DATA_NUM_R10 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R11 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R11_SID_IDX ON RHQ_MEAS_DATA_NUM_R11 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R12 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R12_SID_IDX ON RHQ_MEAS_DATA_NUM_R12 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R13 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R13_SID_IDX ON RHQ_MEAS_DATA_NUM_R13 (schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R14 (SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R14_SID_IDX ON RHQ_MEAS_DATA_NUM_R14 (schedule_id)
</statement>
@@ -1300,7 +1328,7 @@
</schemaSpec>
<schemaSpec version="2.50">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_RESOURCE_ERROR.RESOURCE_ID">
CREATE INDEX RHQ_RES_ERROR_IDX_RES_ID ON RHQ_RESOURCE_ERROR (RESOURCE_ID)
</statement>
@@ -1313,12 +1341,12 @@
</schemaSpec>
<schemaSpec version="2.52">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique name constraint on RHQ_RESOURCE_GROUP">
DROP INDEX RHQ_RES_GROUP_NAME
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique name constraint on RHQ_RESOURCE_GROUP">
CREATE INDEX RHQ_RES_GROUP_NAME ON RHQ_RESOURCE_GROUP (name)
</statement>
@@ -1348,57 +1376,87 @@
</schemaSpec>
<schemaSpec version="2.55">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on TIME_STAMP column of RHQ_MEASUREMENT_DATA_NUM_1H">
CREATE INDEX RHQ_MEAS_DATA_1H_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_1H(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on TIME_STAMP column of RHQ_MEASUREMENT_DATA_NUM_6H">
CREATE INDEX RHQ_MEAS_DATA_6H_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_6H(TIME_STAMP)
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R00 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R00_TS_IDX ON RHQ_MEAS_DATA_NUM_R00 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R01 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R01_TS_IDX ON RHQ_MEAS_DATA_NUM_R01 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R02 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R02_TS_IDX ON RHQ_MEAS_DATA_NUM_R02 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R03 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R03_TS_IDX ON RHQ_MEAS_DATA_NUM_R03 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R04 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R04_TS_IDX ON RHQ_MEAS_DATA_NUM_R04 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R05 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R05_TS_IDX ON RHQ_MEAS_DATA_NUM_R05 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R06 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R06_TS_IDX ON RHQ_MEAS_DATA_NUM_R06 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R07 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R07_TS_IDX ON RHQ_MEAS_DATA_NUM_R07 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R08 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R08_TS_IDX ON RHQ_MEAS_DATA_NUM_R08 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R09 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R09_TS_IDX ON RHQ_MEAS_DATA_NUM_R09 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R10 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R10_TS_IDX ON RHQ_MEAS_DATA_NUM_R10 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R11 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R11_TS_IDX ON RHQ_MEAS_DATA_NUM_R11 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R12 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R12_TS_IDX ON RHQ_MEAS_DATA_NUM_R12 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R13 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R13_TS_IDX ON RHQ_MEAS_DATA_NUM_R13 (TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R14 (TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R14_TS_IDX ON RHQ_MEAS_DATA_NUM_R14 (TIME_STAMP)
</statement>
@@ -1406,49 +1464,77 @@
</schemaSpec>
<schemaSpec version="2.56">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R00_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R00_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R01_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R01_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R02_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R02_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R03_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R03_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R04_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R04_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R05_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R05_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R06_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R06_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R07_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R07_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R08_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R08_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R09_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R09_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R10_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R10_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R11_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R11_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R12_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R12_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R13_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R13_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on RHQ_MEAS_DATA_R14_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R14_SID_IDX
</statement>
@@ -1456,7 +1542,7 @@
</schemaSpec>
<schemaSpec version="2.57">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Create index on RHQ_CONFIG_PROPERTY(PARENT_LIST_ID)">
CREATE INDEX RHQ_CONFIG_PROP_idx_list_key ON RHQ_CONFIG_PROPERTY(PARENT_LIST_ID)
</statement>
@@ -1683,6 +1769,8 @@
FOREIGN KEY ( REPO_GROUP_TYPE_ID )
REFERENCES RHQ_REPO_GROUP_TYPE ( ID )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_REPO_GROUP_IDX
ON RHQ_REPO_GROUP ( NAME, REPO_GROUP_TYPE_ID )
@@ -1842,7 +1930,7 @@
<schema-alterColumn table="RHQ_DISTRIBUTION" column="BASE_PATH" nullable="false" />
<schema-addColumn table="RHQ_DISTRIBUTION" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_DISTRIBUTION" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_DISTRIBUTION_IDX ON RHQ_DISTRIBUTION ( LABEL, BASE_PATH )
</statement>
@@ -1947,6 +2035,8 @@
FOREIGN KEY (DISTRIBUTION_ID)
REFERENCES RHQ_DISTRIBUTION ( ID )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_DISTRIBUTION_FILE_IDX
ON RHQ_DISTRIBUTION_FILE ( DISTRIBUTION_ID, RELATIVE_FILENAME )
@@ -2019,7 +2109,7 @@
</schema-directSQL>
<!-- Fix bug:538157 -->
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE INDEX RHQ_REPO_PKG_VER_MAP_IDX
ON RHQ_REPO_PKG_VERSION_MAP ( PACKAGE_VERSION_ID )
@@ -2040,10 +2130,12 @@
<schemaSpec version="2.69.2">
<!-- plugin names must be unique only if they are deployed on the same side (agent vs. server) -->
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping unique index on RHQ_PLUGIN (NAME)">
DROP INDEX RHQ_PLUGIN_NAME_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RHQ_PLUGIN (NAME, DEPLOYMENT) so server plugin names need not be unique with agent plugins">
CREATE UNIQUE INDEX RHQ_PLUGIN_NAME_DEPLOY_IDX ON RHQ_PLUGIN (NAME, DEPLOYMENT)
</statement>
@@ -2086,7 +2178,7 @@
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="MESSAGE" columnType="VARCHAR2" precision="4000" />
</schemaSpec>
<schemaSpec version="2.70.3">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping unique index RHQ_ALERT_IDX_ALERT">
DROP INDEX RHQ_ALERT_IDX_ALERT
</statement>
@@ -2127,7 +2219,7 @@
<schema-deleteColumn table="RHQ_ALERT" column="triggered_operation" />
</schemaSpec>
<schemaSpec version="2.70.7">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Recreating RHQ_ALERT_IDX_ALERT as non-unique index">
CREATE INDEX RHQ_ALERT_IDX_ALERT ON RHQ_ALERT_NOTIF_LOG (alert_id)
</statement>
@@ -2168,13 +2260,17 @@
<schema-addColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ ON RHQ_ADVISORY ( ADVISORY_NAME )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_UQ ON RHQ_ADVISORY ( ADVISORY )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE INDEX RHQ_ADVISORY_UDATE_IDX ON RHQ_ADVISORY (UPDATE_DATE )
</statement>
@@ -2193,7 +2289,7 @@
<schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="PACKAGE_VERSION_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_PACKAGE_IDX ON RHQ_ADVISORY_PACKAGE ( ADVISORY_ID, PACKAGE_VERSION_ID )
</statement>
@@ -2234,7 +2330,7 @@
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="CVE_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_CVE_IDX ON RHQ_ADVISORY_CVE ( ADVISORY_ID, CVE_ID )
</statement>
@@ -2266,7 +2362,7 @@
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_BUG_IDX ON RHQ_ADVISORY_BUGLIST ( ADVISORY_ID, BUG_ID )
</statement>
@@ -2365,6 +2461,8 @@
FOREIGN KEY (RESOURCE_TYPE_ID)
REFERENCES RHQ_RESOURCE_TYPE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_TYPE unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_TYPE_UNIQUE ON RHQ_BUNDLE_TYPE (name)
</statement>
@@ -2406,6 +2504,8 @@
FOREIGN KEY (PACKAGE_TYPE_ID)
REFERENCES RHQ_PACKAGE_TYPE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_UNIQUE ON RHQ_BUNDLE (bundle_type_id, name)
</statement>
@@ -2444,6 +2544,8 @@
FOREIGN KEY (CONFIG_DEF_ID)
REFERENCES RHQ_CONFIG_DEF (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_VERSION unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_VERSION_UNIQUE ON RHQ_BUNDLE_VERSION (bundle_id, name, version)
</statement>
@@ -2539,6 +2641,8 @@
FOREIGN KEY (GROUP_ID)
REFERENCES RHQ_RESOURCE_GROUP (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_DESTINATION unique constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_DESTINATION_UNIQUE
ON RHQ_BUNDLE_DESTINATION (bundle_id, group_id, deploy_dir)
@@ -2630,6 +2734,8 @@
FOREIGN KEY (RESOURCE_ID)
REFERENCES RHQ_RESOURCE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_RES_DEPLOY unique constraint on dep-resource mapping">
CREATE UNIQUE INDEX RHQ_BUNDLE_RES_DEPLOY_IDX
ON RHQ_BUNDLE_RES_DEPLOY (BUNDLE_DEPLOYMENT_ID, RESOURCE_ID)
@@ -2788,6 +2894,8 @@
FOREIGN KEY ( ROLE_ID )
REFERENCES RHQ_ROLE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ROLE_LDAP_GROUP_IDX
ON RHQ_ROLE_LDAP_GROUP ( ROLE_ID, LDAP_GROUP_NAME )
@@ -2996,10 +3104,12 @@
</schemaSpec>
<schemaSpec version="2.87">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Drop non-unique RHQ_RES_TYPE_IDX_PLG_NAME index">
DROP INDEX RHQ_RES_TYPE_IDX_PLG_NAME
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Recreate RHQ_RES_TYPE_IDX_PLG_NAME index as unique">
CREATE UNIQUE INDEX RHQ_RES_TYPE_IDX_PLG_NAME ON RHQ_RESOURCE_TYPE (name, plugin)
</statement>
@@ -3007,10 +3117,12 @@
</schemaSpec>
<schemaSpec version="2.88">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add end time index on call time data to speed up purges">
CREATE INDEX RHQ_CT_DA_VA_END_TIM_IDX ON RHQ_CALLTIME_DATA_VALUE (end_time)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add index on measurement definition numeric type">
CREATE INDEX RHQ_METRIC_DEF_NT_IDX ON RHQ_MEASUREMENT_DEF (numeric_type)
</statement>
@@ -3131,7 +3243,7 @@
</schemaSpec>
<schemaSpec version="2.92.4">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add index on measurement data 1d table timestamp">
CREATE INDEX RHQ_MEAS_DATA_1D_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_1D (time_stamp)
</statement>
@@ -3294,6 +3406,8 @@
<statement desc="Changing primary key of RHQ_OPERATION_SCHEDULE to ID. Step2/3...">
ALTER TABLE RHQ_OPERATION_SCHEDULE ADD PRIMARY KEY (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Changing primary key of RHQ_OPERATION_SCHEDULE to ID. Step3/3...">
CREATE UNIQUE INDEX RHQ_OPERATION_SCHEDULE_KEY_IDX ON RHQ_OPERATION_SCHEDULE (JOB_NAME, JOB_GROUP)
</statement>
@@ -3607,10 +3721,12 @@
</schemaSpec>
<schemaSpec version="2.113">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_ALERT_CONDITION_LOG index on CONDITION_ID">
CREATE INDEX RHQ_ALERT_COND_LOG_COND_IDX ON RHQ_ALERT_CONDITION_LOG (CONDITION_ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_MEASUREMENT_SCHED index on RESOURCE_ID">
CREATE INDEX RHQ_MEAS_SCHED_RESID_IDX ON RHQ_MEASUREMENT_SCHED (RESOURCE_ID)
</statement>
@@ -3669,7 +3785,7 @@
REFERENCES RHQ_CONFIG (ID)
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RESOURCE_TYPE_ID and NAME columns">
CREATE UNIQUE INDEX RHQ_TYPE_DEF_NAME ON RHQ_DRIFT_DEF_TEMPLATE ( RESOURCE_TYPE_ID, NAME )
</statement>
12 years, 4 months
[rhq] Branch 'release/jon3.0.x' - modules/core
by ips
modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java | 27 ++++++++--
1 file changed, 23 insertions(+), 4 deletions(-)
New commits:
commit 72bb3d37c84b3af4250c5daee87438be9d9fbb26
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Nov 11 10:57:33 2011 -0500
log message reporting invalid numeric metrics at DEBUG, rather than WARN,
to avoid flooding the agent log with repetitive messages
(cherry picked from commit 542a30ca6d0eaebbee5365c756955255ba367e4e)
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
index 5cee6a6..a9136d1 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
@@ -90,15 +90,34 @@ public class MeasurementSenderRunner implements Callable<MeasurementReport>, Run
Iterator<MeasurementDataNumeric> iter = report.getNumericData().iterator();
while (iter.hasNext()) {
MeasurementDataNumeric numeric = iter.next();
- Double v = numeric.getValue();
- if (v == null || v.isInfinite() || v.isNaN()) {
- LOG.warn("Numeric " + numeric.getName() + " with id " + numeric.getScheduleId()
- + " is invalid, value was '" + v + "'");
+ Double value = numeric.getValue();
+ if (value == null || value.isInfinite() || value.isNaN()) {
+ if (LOG.isDebugEnabled()) {
+ String stringValue = getStringValue(value);
+ LOG.debug("Numeric metric [" + numeric.getName() + "] with schedule id [" + numeric.getScheduleId()
+ + "] is invalid - value is [" + stringValue + "].");
+ }
iter.remove();
}
}
}
+ private String getStringValue(Double value) {
+ String stringValue;
+ if (value == null) {
+ stringValue = "null";
+ } else if (value.isNaN()) {
+ stringValue = "Double.NaN";
+ } else if (value == Double.POSITIVE_INFINITY) {
+ stringValue = "Double.POSITIVE_INFINITY";
+ } else if (value == Double.NEGATIVE_INFINITY) {
+ stringValue = "Double.NEGATIVE_INFINITY";
+ } else {
+ stringValue = value.toString();
+ }
+ return stringValue;
+ }
+
public void run() {
try {
call();
12 years, 4 months
[rhq] Branch 'release/jon3.0.x' - modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java | 12 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 34 ++-----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 36 ++++----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java | 10 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java | 41 +++------
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 43 ++++------
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java | 18 ++--
9 files changed, 87 insertions(+), 111 deletions(-)
New commits:
commit b9ccebed287c8cc86ad4e601b3ceb23ec0520770
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 13:32:08 2012 -0500
[Bug 772771 - Agent not syncing updated plugin config at startup]
The resource mtime was not being properly updated when completing the
plugin config sync. If the agent was down at update time it would not
know to sync the resource on startup, or at any point until perhaps
the resource was modified in some other way, or the plugin config was
changed when the agent was up.
Also, in general Resource.setAgentSynchronizationNeeded() should be called
by any code performing an update that requires agent sync. The
Resource.setMtime() method should not be called for this purpose, but
rather only when manual mtime manipulation is required.
- fixed plugin config update
- converted setMtime calls to be setAgentSynchronizationNeeded() where appropriate
- added a missing call to setAgentSynchronizationNeeded() in DiscoveryBossBean
- trivial
-- fixed a method name typo
-- fixed some compiler warnings
-- removed some dead code
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index dd5da1b..c90ed4e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -83,7 +83,7 @@ import org.rhq.core.domain.util.Summary;
* Represents an RHQ managed resource (i.e. a platform, server, or service).
*/
@Entity
-@NamedQueries( {
+@NamedQueries({
@NamedQuery(name = Resource.QUERY_FIND_PROBLEM_RESOURCES_ALERT_ADMIN, query = "" //
+ " SELECT DISTINCT new org.rhq.core.domain.resource.composite.ProblemResourceComposite"
+ " ( "
@@ -1302,6 +1302,12 @@ public class Resource implements Comparable<Resource>, Serializable {
return this.mtime;
}
+ /**
+ * Call this directly only when needing manual manipulation of the mtime. Otherwise, you probably want to
+ * call {@link #setAgentSynchronizationNeeded()}.
+ *
+ * @param mtime
+ */
public void setMtime(long mtime) {
this.mtime = mtime;
}
@@ -1336,8 +1342,6 @@ public class Resource implements Comparable<Resource>, Serializable {
*
* For a list of changes that the agent cares about, see InventoryManager.mergeResource(Resource, Resource)
*/
-
- // @PreUpdate
public void setAgentSynchronizationNeeded() {
this.mtime = System.currentTimeMillis();
}
@@ -1434,7 +1438,7 @@ public class Resource implements Comparable<Resource>, Serializable {
return schedules;
}
- public void setSchendules(Set<MeasurementSchedule> schedules) {
+ public void setSchedules(Set<MeasurementSchedule> schedules) {
this.schedules = schedules;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 5b88fe5..60550be 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -136,7 +136,6 @@ import org.rhq.enterprise.server.util.QuartzUtil;
* @author John Mazzitelli
* @author Ian Springer
*/
-@SuppressWarnings({ "UnnecessaryLocalVariable", "UnnecessaryReturnStatement" })
@Stateless
@XmlType(namespace = ServerVersion.namespace)
public class ConfigurationManagerBean implements ConfigurationManagerLocal, ConfigurationManagerRemote {
@@ -220,6 +219,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
Resource resource = update.getResource();
// link to the newer, persisted configuration object -- regardless of errors
+ resource.setAgentSynchronizationNeeded();
resource.setPluginConfiguration(update.getConfiguration());
if (response.getStatus() == ConfigurationUpdateStatus.SUCCESS) {
@@ -1242,17 +1242,6 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return configService.validate(configuration, resourceId, isStructured);
}
- private boolean isRawSupported(int resourceId) {
- Resource resource = entityManager.find(Resource.class, resourceId);
- ConfigurationDefinition configDef = resource.getResourceType().getResourceConfigurationDefinition();
- if (configDef == null) {
- return false;
- }
-
- return (ConfigurationFormat.STRUCTURED_AND_RAW == configDef.getConfigurationFormat() || (ConfigurationFormat.RAW == configDef
- .getConfigurationFormat()));
- }
-
private boolean isStructuredAndRawSupported(int resourceId) {
Resource resource = entityManager.find(Resource.class, resourceId);
ConfigurationDefinition configDef = resource.getResourceType().getResourceConfigurationDefinition();
@@ -1691,7 +1680,6 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public Configuration getConfiguration(Subject subject, int configurationId) {
- @SuppressWarnings({ "UnnecessaryLocalVariable" })
Configuration configuration = getConfigurationById(configurationId);
return configuration;
}
@@ -2337,7 +2325,6 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return out;
}
- @SuppressWarnings("unchecked")
public PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdatesByCriteria(Subject subject,
ResourceConfigurationUpdateCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
@@ -2346,8 +2333,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
"resource", subject.getId());
}
- CriteriaQueryRunner<ResourceConfigurationUpdate> queryRunner = new CriteriaQueryRunner(criteria, generator,
- entityManager);
+ CriteriaQueryRunner<ResourceConfigurationUpdate> queryRunner = new CriteriaQueryRunner<ResourceConfigurationUpdate>(
+ criteria, generator, entityManager);
PageList<ResourceConfigurationUpdate> updates = queryRunner.execute();
@@ -2371,7 +2358,6 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return updates;
}
- @SuppressWarnings("unchecked")
public PageList<PluginConfigurationUpdate> findPluginConfigurationUpdatesByCriteria(Subject subject,
PluginConfigurationUpdateCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
@@ -2380,8 +2366,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
"resource", subject.getId());
}
- CriteriaQueryRunner<PluginConfigurationUpdate> queryRunner = new CriteriaQueryRunner(criteria, generator,
- entityManager);
+ CriteriaQueryRunner<PluginConfigurationUpdate> queryRunner = new CriteriaQueryRunner<PluginConfigurationUpdate>(
+ criteria, generator, entityManager);
PageList<PluginConfigurationUpdate> updates = queryRunner.execute();
@@ -2405,7 +2391,6 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return updates;
}
- @SuppressWarnings("unchecked")
public PageList<GroupResourceConfigurationUpdate> findGroupResourceConfigurationUpdatesByCriteria(Subject subject,
GroupResourceConfigurationUpdateCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
@@ -2414,8 +2399,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
subject.getId());
}
- CriteriaQueryRunner<GroupResourceConfigurationUpdate> queryRunner = new CriteriaQueryRunner(criteria,
- generator, entityManager);
+ CriteriaQueryRunner<GroupResourceConfigurationUpdate> queryRunner = new CriteriaQueryRunner<GroupResourceConfigurationUpdate>(
+ criteria, generator, entityManager);
PageList<GroupResourceConfigurationUpdate> updates = queryRunner.execute();
@@ -2438,7 +2423,6 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return updates;
}
- @SuppressWarnings("unchecked")
public PageList<GroupPluginConfigurationUpdate> findGroupPluginConfigurationUpdatesByCriteria(Subject subject,
GroupPluginConfigurationUpdateCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
@@ -2447,8 +2431,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
subject.getId());
}
- CriteriaQueryRunner<GroupPluginConfigurationUpdate> queryRunner = new CriteriaQueryRunner(criteria, generator,
- entityManager);
+ CriteriaQueryRunner<GroupPluginConfigurationUpdate> queryRunner = new CriteriaQueryRunner<GroupPluginConfigurationUpdate>(
+ criteria, generator, entityManager);
PageList<GroupPluginConfigurationUpdate> updates = queryRunner.execute();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index 2ea6234..7609492 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.discovery;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@@ -29,7 +30,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import java.util.Date;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -44,12 +44,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
+
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.discovery.InvalidPluginConfigurationClientException;
import org.rhq.core.clientapi.agent.upgrade.ResourceUpgradeRequest;
@@ -314,16 +314,15 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
final String randomSuffix = UUID.randomUUID().toString();
final String triggerName = TRIGGER_PREFIX + " - " + randomSuffix;
- SimpleTrigger trigger = new SimpleTrigger(triggerName, DEFAULT_JOB_GROUP,
- new Date());
+ SimpleTrigger trigger = new SimpleTrigger(triggerName, DEFAULT_JOB_GROUP, new Date());
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put(AgentInventoryStatusUpdateJob.KEY_TRIGGER_NAME, triggerName);
jobDataMap.put(AgentInventoryStatusUpdateJob.KEY_TRIGGER_GROUP_NAME, DEFAULT_JOB_GROUP);
AgentInventoryStatusUpdateJob.externalizeJobValues(jobDataMap,
- AgentInventoryStatusUpdateJob.PLATFORMS_COMMA_LIST, platforms);
+ AgentInventoryStatusUpdateJob.PLATFORMS_COMMA_LIST, platforms);
AgentInventoryStatusUpdateJob.externalizeJobValues(jobDataMap,
- AgentInventoryStatusUpdateJob.SERVERS_COMMA_LIST, servers);
+ AgentInventoryStatusUpdateJob.SERVERS_COMMA_LIST, servers);
trigger.setJobName(DEFAULT_JOB_NAME);
trigger.setJobGroup(DEFAULT_JOB_GROUP);
@@ -333,7 +332,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
scheduler.scheduleJob(trigger);
} else {
JobDetail jobDetail = new JobDetail(DEFAULT_JOB_NAME, DEFAULT_JOB_GROUP,
- AgentInventoryStatusUpdateJob.class);
+ AgentInventoryStatusUpdateJob.class);
scheduler.scheduleJob(jobDetail, trigger);
}
} catch (SchedulerException e) {
@@ -357,10 +356,10 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
AgentClient agentClient = agentManager.getAgentClient(platform.getAgent());
try {
agentClient.getDiscoveryAgentService().synchronizeInventory(
- entityManager.find(ResourceSyncInfo.class, platform.getId()));
+ entityManager.find(ResourceSyncInfo.class, platform.getId()));
} catch (Exception e) {
log.warn("Could not perform commit synchronization with agent for platform [" + platform.getName()
- + "]", e);
+ + "]", e);
}
}
for (Resource server : servers) {
@@ -369,10 +368,10 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
AgentClient agentClient = agentManager.getAgentClient(server.getAgent());
try {
agentClient.getDiscoveryAgentService().synchronizeInventory(
- entityManager.find(ResourceSyncInfo.class, server.getId()));
+ entityManager.find(ResourceSyncInfo.class, server.getId()));
} catch (Exception e) {
log.warn("Could not perform commit synchronization with agent for server [" + server.getName()
- + "]", e);
+ + "]", e);
}
}
}
@@ -511,6 +510,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
}
}
+ @SuppressWarnings("deprecation")
public Set<ResourceUpgradeResponse> upgradeResources(Set<ResourceUpgradeRequest> upgradeRequests) {
Set<ResourceUpgradeResponse> result = new HashSet<ResourceUpgradeResponse>();
@@ -588,8 +588,9 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
private ResourceUpgradeResponse upgradeResource(@NotNull Resource resource, ResourceUpgradeRequest upgradeRequest,
boolean allowGenericPropertiesUpgrade) {
if (upgradeRequest.getUpgradeErrorMessage() != null) {
- ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE, upgradeRequest
- .getUpgradeErrorMessage(), upgradeRequest.getUpgradeErrorStackTrace(), upgradeRequest.getTimestamp());
+ ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE,
+ upgradeRequest.getUpgradeErrorMessage(), upgradeRequest.getUpgradeErrorStackTrace(),
+ upgradeRequest.getTimestamp());
resourceManager.addResourceError(error);
return null;
}
@@ -767,8 +768,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
continue;
}
}
- existingResource = resourceManager.getResourceByParentAndKey(overlord, existingParent, resource
- .getResourceKey(), resourceType.getPlugin(), resourceType.getName());
+ existingResource = resourceManager.getResourceByParentAndKey(overlord, existingParent,
+ resource.getResourceKey(), resourceType.getPlugin(), resourceType.getName());
}
if (existingResource != null) {
@@ -871,6 +872,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
if (existingResource.getInventoryStatus() == InventoryStatus.DELETED) {
existingResource.setInventoryStatus(InventoryStatus.COMMITTED);
existingResource.setPluginConfiguration(updatedResource.getPluginConfiguration());
+ existingResource.setAgentSynchronizationNeeded();
}
for (Resource childResource : updatedResource.getChildResources()) {
@@ -1021,14 +1023,14 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
// Do one query per 1000 Resource id's to prevent Oracle from failing because of an IN clause with more
// than 1000 items.
- List<Resource> resources = new ArrayList(resourceIds.length);
+ List<Resource> resources = new ArrayList<Resource>(resourceIds.length);
fromIndex = 0;
while (fromIndex < resourceIds.length) {
int toIndex = (resourceIds.length < (fromIndex + 1000)) ? resourceIds.length : (fromIndex + 1000);
int[] resourceIdSubArray = Arrays.copyOfRange(resourceIds, fromIndex, toIndex);
PageList<Resource> batchResources = resourceManager.findResourceByIds(subject, resourceIdSubArray, false,
- PageControl.getUnlimitedInstance());
+ PageControl.getUnlimitedInstance());
resources.addAll(batchResources);
fromIndex = toIndex;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java
index c899487..964d84c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java
@@ -160,7 +160,7 @@ class WsResourceListWrapper extends Resource {
destination.setProductVersion(source.getProductVersion());
destination.setResourceConfiguration(source.getResourceConfiguration());
destination.setResourceConfigurationUpdates(source.getResourceConfigurationUpdates());
- destination.setSchendules(source.getSchedules());
+ destination.setSchedules(source.getSchedules());
destination.setUuid(source.getUuid());
//handle the problematic references that would cause cycles if used by storing only ids.
if (source.getParentResource() != null) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java
index 20d1c95..3c74f06 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java
@@ -116,7 +116,7 @@ class WsResource extends Resource {
destination.setProductVersion(source.getProductVersion());
destination.setResourceConfiguration(source.getResourceConfiguration());
destination.setResourceConfigurationUpdates(source.getResourceConfigurationUpdates());
- destination.setSchendules(source.getSchedules());
+ destination.setSchedules(source.getSchedules());
destination.setUuid(source.getUuid());
//handle the problematic references that would cause cycles if used by storing only ids.
if (source.getParentResource() != null) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java
index 8a21886..fba8a68 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java
@@ -74,8 +74,6 @@ public class MeasurementDefinitionManagerBean implements MeasurementDefinitionMa
* @param def the MeasuremendDefinition to delete
*/
public void removeMeasurementDefinition(MeasurementDefinition def) {
- long now = System.currentTimeMillis();
-
// First remove the schedules and associated OOBs.
List<MeasurementSchedule> schedules = def.getSchedules();
Iterator<MeasurementSchedule> schedIter = schedules.iterator();
@@ -86,8 +84,7 @@ public class MeasurementDefinitionManagerBean implements MeasurementDefinitionMa
sched.setBaseline(null);
}
oobManager.removeOOBsForSchedule(subjectManager.getOverlord(), sched);
- // IMPORTANT: Update the mtime to tell the Agent this Resource needs to be synced.
- sched.getResource().setMtime(now);
+ sched.getResource().setAgentSynchronizationNeeded();
entityManager.remove(sched);
schedIter.remove();
}
@@ -134,14 +131,13 @@ public class MeasurementDefinitionManagerBean implements MeasurementDefinitionMa
return results;
}
- @SuppressWarnings("unchecked")
public PageList<MeasurementDefinition> findMeasurementDefinitionsByCriteria(Subject subject,
MeasurementDefinitionCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
;
- CriteriaQueryRunner<MeasurementDefinition> queryRunner = new CriteriaQueryRunner(criteria, generator,
- entityManager);
+ CriteriaQueryRunner<MeasurementDefinition> queryRunner = new CriteriaQueryRunner<MeasurementDefinition>(
+ criteria, generator, entityManager);
return queryRunner.execute();
}
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
index e5df592..bbc2a1d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
@@ -23,21 +23,14 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Date;
import java.util.UUID;
-import org.quartz.Trigger;
-import org.quartz.Scheduler;
-import org.quartz.JobDetail;
-import org.quartz.JobDataMap;
-import org.quartz.SimpleTrigger;
-import org.quartz.SchedulerException;
-
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
@@ -51,6 +44,12 @@ import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.SimpleTrigger;
+import org.quartz.Trigger;
import org.jboss.annotation.IgnoreDependency;
@@ -317,13 +316,13 @@ public class MeasurementScheduleManagerBean implements MeasurementScheduleManage
return;
}
- @RequiredPermissions( { @RequiredPermission(Permission.MANAGE_INVENTORY),
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_INVENTORY),
@RequiredPermission(Permission.MANAGE_SETTINGS) })
public void disableAllDefaultCollections(Subject subject) {
entityManager.createNamedQuery(MeasurementDefinition.DISABLE_ALL).executeUpdate();
}
- @RequiredPermissions( { @RequiredPermission(Permission.MANAGE_INVENTORY),
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_INVENTORY),
@RequiredPermission(Permission.MANAGE_SETTINGS) })
public void disableAllSchedules(Subject subject) {
entityManager.createNamedQuery(MeasurementSchedule.DISABLE_ALL).executeUpdate();
@@ -331,11 +330,10 @@ public class MeasurementScheduleManagerBean implements MeasurementScheduleManage
}
public void createSchedulesForExistingResources(ResourceType type, MeasurementDefinition newDefinition) {
- long now = System.currentTimeMillis();
List<Resource> resources = type.getResources();
if (resources != null) {
for (Resource res : resources) {
- res.setMtime(now); // changing MTime tells the agent this resource needs to be synced
+ res.setAgentSynchronizationNeeded();
MeasurementSchedule sched = new MeasurementSchedule(newDefinition, res);
sched.setInterval(newDefinition.getDefaultInterval());
entityManager.persist(sched);
@@ -648,16 +646,10 @@ public class MeasurementScheduleManagerBean implements MeasurementScheduleManage
final String randomSuffix = UUID.randomUUID().toString();
final String jobName = DEFAULT_AGENT_JOB + " - " + randomSuffix;
- JobDetail jobDetail = new JobDetail(
- jobName,
- DEFAULT_AGENT_GROUP,
- NotifyAgentsOfScheduleUpdatesJob.class);
+ JobDetail jobDetail = new JobDetail(jobName, DEFAULT_AGENT_GROUP, NotifyAgentsOfScheduleUpdatesJob.class);
final String triggerName = DEFAULT_AGENT_TRIGGER + " - " + randomSuffix;
- SimpleTrigger simpleTrigger = new SimpleTrigger(
- triggerName,
- DEFAULT_AGENT_GROUP,
- new Date());
+ SimpleTrigger simpleTrigger = new SimpleTrigger(triggerName, DEFAULT_AGENT_GROUP, new Date());
JobDataMap jobDataMap = simpleTrigger.getJobDataMap();
jobDataMap.put(TRIGGER_NAME, triggerName);
@@ -1235,8 +1227,8 @@ public class MeasurementScheduleManagerBean implements MeasurementScheduleManage
// first get all the resources, which is needed to get the agent mappings
Subject overlord = subjectManager.getOverlord();
- PageList<Resource> resources = resourceManager.findResourceByIds(overlord, resourceIds, false, PageControl
- .getUnlimitedInstance());
+ PageList<Resource> resources = resourceManager.findResourceByIds(overlord, resourceIds, false,
+ PageControl.getUnlimitedInstance());
// then get all the requests
Set<ResourceMeasurementScheduleRequest> requests = findSchedulesForResourceAndItsDescendants(resourceIds, false);
@@ -1482,8 +1474,8 @@ public class MeasurementScheduleManagerBean implements MeasurementScheduleManage
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
;
if (authorizationManager.isInventoryManager(subject) == false) {
- generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.RESOURCE, subject
- .getId());
+ generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.RESOURCE,
+ subject.getId());
}
CriteriaQueryRunner<MeasurementSchedule> queryRunner = new CriteriaQueryRunner(criteria, generator,
@@ -1522,4 +1514,3 @@ public class MeasurementScheduleManagerBean implements MeasurementScheduleManage
// }
}
-
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 4cbc3d1..fcc6638 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -238,8 +238,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
persistedResource.setLocation(resource.getLocation());
persistedResource.setDescription(resource.getDescription());
- // NOTE: Updating the mtime will tell the Agent it needs to sync this Resource.
- persistedResource.setMtime(System.currentTimeMillis());
+ persistedResource.setAgentSynchronizationNeeded();
persistedResource.setModifiedBy(user.getName());
return entityManager.merge(persistedResource);
@@ -614,7 +613,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
private void updateInventoryStatus(Resource resource, InventoryStatus newStatus, long now) {
resource.setInventoryStatus(newStatus);
resource.setItime(now);
- resource.setMtime(now);
+ resource.setAgentSynchronizationNeeded();
}
@SuppressWarnings("unchecked")
@@ -757,8 +756,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// Build up a list of composite Resources for the ancestry that includes which ancestors, if any, should be
// locked from view.
boolean isInventoryManager = authorizationManager.isInventoryManager(subject);
- List<ResourceLineageComposite> resourceLineage = new ArrayList<ResourceLineageComposite>(rawResourceLineage
- .size());
+ List<ResourceLineageComposite> resourceLineage = new ArrayList<ResourceLineageComposite>(
+ rawResourceLineage.size());
for (Resource resource : rawResourceLineage) {
boolean isLocked = !(isInventoryManager || authorizationManager.canViewResource(subject, resource.getId()));
ResourceLineageComposite composite = new ResourceLineageComposite(resource, isLocked);
@@ -776,8 +775,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// If the ancestor is not locked, include viewable children.
if (!ancestor.isLocked() || ancestor.getResource() == parent) {
// Get all viewable committed children.
- PageList<Resource> children = findChildResourcesByCategoryAndInventoryStatus(subject, ancestor
- .getResource(), null, InventoryStatus.COMMITTED, PageControl.getUnlimitedInstance());
+ PageList<Resource> children = findChildResourcesByCategoryAndInventoryStatus(subject,
+ ancestor.getResource(), null, InventoryStatus.COMMITTED, PageControl.getUnlimitedInstance());
// Remove any that are in the lineage to avoid repeated handling.
children.removeAll(rawResourceLineage);
for (Resource child : children) {
@@ -1384,7 +1383,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return result;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public List<AutoGroupComposite> findResourcesAutoGroups(Subject subject, int[] resourceIds) {
List<AutoGroupComposite> results = new ArrayList<AutoGroupComposite>();
List<Integer> ids = ArrayUtils.wrapInList(resourceIds);
@@ -1484,6 +1483,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
query.setParameter("inventoryStatus", InventoryStatus.COMMITTED);
List<Object[]> objs = query.getResultList();
+ @SuppressWarnings("rawtypes")
List results = new ArrayList<ResourceWithAvailability>(objs.size());
for (Object[] ob : objs) {
Resource r = (Resource) ob[0];
@@ -1814,7 +1814,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
List<Resource> resources = query.getResultList();
- return new PageList(resources, (int) count, pageControl);
+ return new PageList<Resource>(resources, (int) count, pageControl);
}
@SuppressWarnings("unchecked")
@@ -1847,7 +1847,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
List<Resource> resources = query.getResultList();
- return new PageList(resources, (int) count, pageControl);
+ return new PageList<Resource>(resources, (int) count, pageControl);
}
@SuppressWarnings("unchecked")
@@ -1890,7 +1890,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
List<Resource> resources = query.getResultList();
- return new PageList(resources, (int) count, pageControl);
+ return new PageList<Resource>(resources, (int) count, pageControl);
}
@SuppressWarnings("unchecked")
@@ -2396,7 +2396,6 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return results;
}
- @SuppressWarnings("unchecked")
public PageList<ResourceComposite> findResourceCompositesByCriteria(Subject subject, ResourceCriteria criteria) {
boolean isInventoryManager = authorizationManager.isInventoryManager(subject);
@@ -2440,8 +2439,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
subject.getId());
}
- CriteriaQueryRunner<ResourceComposite> queryRunner = new CriteriaQueryRunner(criteria, generator,
- entityManager, false); // don't auto-init bags, we're returning composites not entities
+ CriteriaQueryRunner<ResourceComposite> queryRunner = new CriteriaQueryRunner<ResourceComposite>(criteria,
+ generator, entityManager, false); // don't auto-init bags, we're returning composites not entities
PageList<ResourceComposite> results = queryRunner.execute();
for (ResourceComposite nextComposite : results) {
@@ -2456,7 +2455,6 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return results;
}
- @SuppressWarnings("unchecked")
public PageList<Resource> findResourcesByCriteria(Subject subject, ResourceCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
@@ -2470,7 +2468,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
subject.getId());
}
- CriteriaQueryRunner<Resource> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager);
+ CriteriaQueryRunner<Resource> queryRunner = new CriteriaQueryRunner<Resource>(criteria, generator,
+ entityManager);
PageList<Resource> results = queryRunner.execute();
return results;
}
@@ -2521,8 +2520,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
public <T> List<DisambiguationReport<T>> disambiguate(List<T> results, IntExtractor<? super T> extractor,
DisambiguationUpdateStrategy updateStrategy) {
- return Disambiguator.disambiguate(results, updateStrategy, extractor, entityManager, typeManager
- .getDuplicateTypeNames());
+ return Disambiguator.disambiguate(results, updateStrategy, extractor, entityManager,
+ typeManager.getDuplicateTypeNames());
}
public void updateAncestry(Subject subject, int resourceId) {
@@ -2545,13 +2544,13 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
@SuppressWarnings("unchecked")
public List<Integer> findIdsByTypeIds(List<Integer> resourceTypeIds) {
- return entityManager.createNamedQuery(Resource.QUERY_FIND_IDS_BY_TYPE_IDS).setParameter("resourceTypeIds",
- resourceTypeIds).getResultList();
+ return entityManager.createNamedQuery(Resource.QUERY_FIND_IDS_BY_TYPE_IDS)
+ .setParameter("resourceTypeIds", resourceTypeIds).getResultList();
}
@Override
public Integer getResourceCount(List<Integer> resourceTypeIds) {
- return (Integer) entityManager.createNamedQuery(Resource.QUERY_FIND_COUNT_BY_TYPES).setParameter(
- "resourceTypeIds", resourceTypeIds).getSingleResult();
+ return (Integer) entityManager.createNamedQuery(Resource.QUERY_FIND_COUNT_BY_TYPES)
+ .setParameter("resourceTypeIds", resourceTypeIds).getSingleResult();
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
index 3963f9d..841fe03 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
@@ -1,6 +1,5 @@
package org.rhq.enterprise.server.resource.metadata;
-import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
@@ -58,8 +57,8 @@ public class PluginConfigurationMetadataManagerBean implements PluginConfigurati
// all new
if (existingConfigurationDefinition == null) {
if (log.isDebugEnabled()) {
- log.debug(existingType + " currently does not have a plugin configuration definition. Adding " +
- "new plugin configuration.");
+ log.debug(existingType + " currently does not have a plugin configuration definition. Adding "
+ + "new plugin configuration.");
}
entityMgr.persist(newType.getPluginConfigurationDefinition());
existingType.setPluginConfigurationDefinition(newType.getPluginConfigurationDefinition());
@@ -72,8 +71,8 @@ public class PluginConfigurationMetadataManagerBean implements PluginConfigurati
.updateConfigurationDefinition(newType.getPluginConfigurationDefinition(),
existingConfigurationDefinition);
- if (updateReport.getNewPropertyDefinitions().size() > 0 ||
- updateReport.getUpdatedPropertyDefinitions().size() > 0) {
+ if (updateReport.getNewPropertyDefinitions().size() > 0
+ || updateReport.getUpdatedPropertyDefinitions().size() > 0) {
Subject overlord = subjectMgr.getOverlord();
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
@@ -99,6 +98,7 @@ public class PluginConfigurationMetadataManagerBean implements PluginConfigurati
private void updateResourcePluginConfiguration(Resource resource, ConfigurationDefinitionUpdateReport updateReport) {
Configuration pluginConfiguration = resource.getPluginConfiguration();
boolean modified = false;
+ @SuppressWarnings("unused")
int numberOfProperties = pluginConfiguration.getProperties().size();
ConfigurationTemplate template = updateReport.getConfigurationDefinition().getDefaultTemplate();
Configuration templateConfiguration = template.getConfiguration();
@@ -106,10 +106,10 @@ public class PluginConfigurationMetadataManagerBean implements PluginConfigurati
for (PropertyDefinition propertyDef : updateReport.getNewPropertyDefinitions()) {
if (propertyDef.isRequired()) {
Property templateProperty = templateConfiguration.get(propertyDef.getName());
- if (templateProperty==null) {
+ if (templateProperty == null) {
throw new IllegalArgumentException("The property [" + propertyDef.getName()
- + "] marked as required in the configuration definition of [" + propertyDef.getConfigurationDefinition().getName()
- + "] has no attribute 'default'");
+ + "] marked as required in the configuration definition of ["
+ + propertyDef.getConfigurationDefinition().getName() + "] has no attribute 'default'");
} else {
pluginConfiguration.put(templateProperty.deepCopy(false));
modified = true;
@@ -129,7 +129,7 @@ public class PluginConfigurationMetadataManagerBean implements PluginConfigurati
}
if (modified) {
- resource.setMtime(new Date().getTime());
+ resource.setAgentSynchronizationNeeded();
}
}
}
12 years, 5 months
[rhq] Branch 'release/jon3.0.x' - 5 commits - modules/core
by Jay Shaughnessy
modules/core/dbutils/pom.xml | 8 --
modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java | 23 ++++++++
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 27 ++++++++--
3 files changed, 47 insertions(+), 11 deletions(-)
New commits:
commit e80294f5775b38e4e99c242aef4cbfcc01fd2c45
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 13:15:04 2012 -0500
Add a demarcation comment for JON 3.0.1
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index f005ff0..7dd68d4 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3828,6 +3828,8 @@
</schema-directSQL>
</schemaSpec>
+<!-- JON 3.0.1 RELEASE uses DB Schema 2.118 -->
+
</dbupgrade>
</target>
</project>
commit b7faba1d8d376f32407fa306db7c0a5df4d63585
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Dec 15 13:16:59 2011 -0500
Supporting check-in for [Bug 768031 - Pin template failure on upgraded dbs]
- Fix a long standing issue in dbupgrade due to Oracle throwing exceptions
when trying to set nullable to the current value. In other words, the
upgrade would fail on oracle if you tried to set nullable false on a
column that was already nullable false. (same for nullable true). This
caused issues when you can't guarantee the current state, you just know
what you need it to be. Now, catch the relevant exceptions and toss
them as needed.
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
index afd9ed9..ad038b0 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
@@ -25,6 +25,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+import mazz.i18n.Logger;
+
/**
* Superclass of all versions of the Oracle database.
*
@@ -32,6 +34,8 @@ import java.util.List;
*
*/
public abstract class OracleDatabaseType extends DatabaseType {
+ private static final Logger LOG = DbUtilsI18NFactory.getLogger(OracleDatabaseType.class);
+
/**
* The vendor name for all Oracle databases.
*/
@@ -156,7 +160,24 @@ public abstract class OracleDatabaseType extends DatabaseType {
sql += ")";
- executeSql(conn, sql);
+ try {
+ executeSql(conn, sql);
+ } catch (SQLException e) {
+ // Oracle throws an exception if you try to set nullable to its current setting. Ignore errors
+ // generated when a nullable setting is already the way we want it to be.
+ // ORA-01442: column to be modified to NOT NULL is already NOT NULL
+ // ORA-01451: column to be modified to NULL cannot be modified to NULL
+ if (nullable != null) {
+ String msg = e.getMessage();
+ if (msg.contains("ORA-01442") || msg.contains("ORA-01451")) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Ignoring exception, column already set to nullable=" + nullable, e);
+ }
+ } else {
+ throw e;
+ }
+ }
+ }
if ((reindex != null) && reindex.booleanValue()) {
reindexTable(conn, table);
commit 8667a4c591e4ef6f803d0b485e3e7cfda76f3440
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Dec 15 13:18:32 2011 -0500
[Bug 768031 - Pin template failure on upgraded dbs]
Set RHQ_DRIFT_CHANGE_SET.DRIFT_DEFINITION_ID nullable in the db upgrade.
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index b77d98a..f005ff0 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3813,7 +3813,10 @@
<schemaSpec version="2.117">
<!-- Remove an obsolete drift table that may be hanging around -->
- <schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
+ <schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
+
+ <!-- Remove an unwanted null consraint -->
+ <schema-alterColumn table="RHQ_DRIFT_CHANGE_SET" column="DRIFT_DEFINITION_ID" nullable="TRUE" />
</schemaSpec>
<schemaSpec version="2.118">
commit 8b8ce32cf7bc2ab04c28d9717911007878ba895a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Jan 9 15:45:21 2012 -0500
[Bug 772742 - DB upgrade gives "All Resources Role" an unintended permission]
Fix the upgrade step that grants the bad permission. And add a new
step to revoke it if it exists.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index f08d22d..f58d07d 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -15,7 +15,7 @@
<description>Database schema setup, upgrade and other utilities</description>
<properties>
- <db.schema.version>2.117</db.schema.version>
+ <db.schema.version>2.118</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
<rhq.ds.connection-url>${rhq.test.ds.connection-url}</rhq.ds.connection-url>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index c690317..b77d98a 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3370,12 +3370,12 @@
</statement>
</schema-directSQL>
- <!-- Now add modify the permissions to give all the roles with MANAGE_INVENTORY
- the new MANAGE_REPOSITORIES privilege so that people's privs remain unchanged. -->
+ <!-- Now modify the permissions to give all the roles with MANAGE_INVENTORY, except for
+ all-resources-role, the new MANAGE_REPOSITORIES privilege so that privs remain unchanged. -->
<schema-directSQL>
<statement>
INSERT INTO RHQ_PERMISSION (role_id, operation)
- SELECT role_id, 15 FROM RHQ_PERMISSION WHERE operation = 1
+ SELECT role_id, 15 FROM RHQ_PERMISSION WHERE operation = 1 AND NOT role_id = 2
</statement>
</schema-directSQL>
</schemaSpec>
@@ -3815,6 +3815,15 @@
<!-- Remove an obsolete drift table that may be hanging around -->
<schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
</schemaSpec>
+
+ <schemaSpec version="2.118">
+ <!-- Correct an earlier upgrade issue where 'All Resources Role' was granted MANAGE_REPOSITORIES. -->
+ <schema-directSQL>
+ <statement>
+ DELETE FROM RHQ_PERMISSION WHERE role_id = 2 AND operation = 15
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
</dbupgrade>
</target>
commit fb7177edccdd59a8f33cdc1253d6d02428ea51b5
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 12:21:44 2012 -0500
Add 2.117 to remove an obsolete drift table that may exist after upgrades.
Conflicts:
modules/core/dbutils/pom.xml
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index b298636..f08d22d 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -14,14 +14,8 @@
<name>RHQ Database Utilities</name>
<description>Database schema setup, upgrade and other utilities</description>
- <scm>
- <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/core/dbutils</connection>
- <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/core/dbutils</developerConnection>
- </scm>
-
<properties>
- <scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.116</db.schema.version>
+ <db.schema.version>2.117</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
<rhq.ds.connection-url>${rhq.test.ds.connection-url}</rhq.ds.connection-url>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index fb2ed85..c690317 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3809,6 +3809,13 @@
<schema-alterColumn table="RHQ_PRD_VER" column="VERSION" columnType="VARCHAR2" precision="100" />
</schemaSpec>
+<!-- JON 3.0 RELEASE uses DB Schema 2.116 -->
+
+ <schemaSpec version="2.117">
+ <!-- Remove an obsolete drift table that may be hanging around -->
+ <schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
12 years, 5 months
[rhq] 2 commits - modules/enterprise
by lkrejci
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java | 8
modules/enterprise/server/client-api/pom.xml | 7
modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/LocalClient.java | 15 +
modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/LocalClientTest.java | 101 ++++++++++
4 files changed, 127 insertions(+), 4 deletions(-)
New commits:
commit c9cc6ed13db6d9d246611f627323abc86bd3f461
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Jan 31 19:11:25 2012 +0100
[BZ 786194] - Make sure to set the correct context classloader when
simplifying the interfaces for the LocalClientProxy.
diff --git a/modules/enterprise/server/client-api/pom.xml b/modules/enterprise/server/client-api/pom.xml
index 29ac29a..f200744 100644
--- a/modules/enterprise/server/client-api/pom.xml
+++ b/modules/enterprise/server/client-api/pom.xml
@@ -40,6 +40,13 @@
<version>1.0</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>test-utils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<profiles>
diff --git a/modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/LocalClientTest.java b/modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/LocalClientTest.java
new file mode 100644
index 0000000..3b949e3
--- /dev/null
+++ b/modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/LocalClientTest.java
@@ -0,0 +1,101 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.client.test;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+import org.jmock.Expectations;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.client.LocalClient;
+import org.rhq.enterprise.server.alert.AlertManagerLocal;
+import org.rhq.enterprise.server.alert.AlertManagerRemote;
+import org.rhq.test.JMockTest;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public class LocalClientTest extends JMockTest {
+
+ public static class FakeContextFactory implements InitialContextFactory {
+ @Override
+ public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
+ return CONTEXT_MOCK_FOR_TEST;
+ }
+ }
+
+ public static Context CONTEXT_MOCK_FOR_TEST = null;
+
+ @BeforeClass
+ public void setUpNaming() {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FakeContextFactory.class.getName());
+ }
+
+ @Test
+ public void testResilienceAgainstContextClassloaders() throws Exception {
+ CONTEXT_MOCK_FOR_TEST = context.mock(Context.class);
+ final AlertManagerRemote alertManagerMock = (AlertManagerRemote) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[] { AlertManagerRemote.class, AlertManagerLocal.class }, new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ return null;
+ }
+
+ });
+
+ context.checking(new Expectations() {{
+ allowing(CONTEXT_MOCK_FOR_TEST).lookup(with(any(String.class)));
+ will(returnValue(alertManagerMock));
+
+ allowing(CONTEXT_MOCK_FOR_TEST).close();
+ }});
+
+ ClassLoader origCl = Thread.currentThread().getContextClassLoader();
+ try {
+ ClassLoader differentCl = new URLClassLoader(new URL[0], getClass().getClassLoader());
+
+ Thread.currentThread().setContextClassLoader(differentCl);
+
+ LocalClient lc = new LocalClient(null);
+
+ //this call creates the proxy and is theoretically prone to the context classloader
+ AlertManagerRemote am = lc.getAlertManager();
+
+ //check that both the original and simplified methods exist on the returned object
+ am.getClass().getMethod("deleteAlerts", new Class<?>[] { Subject.class, int[].class });
+ am.getClass().getMethod("deleteAlerts", new Class<?>[] { int[].class });
+ } finally {
+ Thread.currentThread().setContextClassLoader(origCl);
+ }
+ }
+}
commit ef9f0ada2d2ac587d701da5ea03507b2fb74b8c3
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Mon Jan 30 18:37:21 2012 +0100
Make sure to set the correct context classloader when running inside
a EJB container.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java
index 6f15e81..2c1258d 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java
@@ -199,7 +199,13 @@ public class ResourceClientFactory {
}
}
- return customClass.toClass();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(ResourceClientProxy.class.getClassLoader());
+ return customClass.toClass();
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
} catch (NotFoundException e) {
LOG.error("Could not create custom interface for resource with id " + proxy.getId(), e);
} catch (CannotCompileException e) {
diff --git a/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/LocalClient.java b/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/LocalClient.java
index 2414bf6..2e48048 100644
--- a/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/LocalClient.java
+++ b/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/LocalClient.java
@@ -432,10 +432,19 @@ public class LocalClient implements RhqFacade {
private <T> T getProxy(Object slsb, Class<T> iface) {
RhqManagers manager = RhqManagers.forInterface(iface);
- Class<?> simplified = InterfaceSimplifier.simplify(iface);
+ Class<?> simplified = null;
+
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(iface.getClassLoader());
+ simplified = InterfaceSimplifier.simplify(iface);
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
- Object proxy = Proxy.newProxyInstance(iface.getClassLoader(), new Class<?>[] { simplified },
- new LocalClientProxy(slsb, this, manager));
+ Object proxy =
+ Proxy.newProxyInstance(iface.getClassLoader(), new Class<?>[] { simplified }, new LocalClientProxy(slsb,
+ this, manager));
return iface.cast(proxy);
}
12 years, 5 months
[rhq] modules/core
by ips
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java | 7
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java | 64 ++--
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java | 160 ++++++----
modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java | 3
modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java | 7
5 files changed, 156 insertions(+), 85 deletions(-)
New commits:
commit 5b7557b941711586d3c3be1447e0a9c3319fe029
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jan 31 12:21:04 2012 -0500
[BZ 785026] log an informative warning, if log files cannot be polled for events due to SIGAR being disabled or unavailable (https://bugzilla.redhat.com/show_bug.cgi?id=785026)
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java
index f9bb654..8651272 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java
@@ -22,6 +22,7 @@
*/
package org.rhq.core.pluginapi.event;
+import com.sun.istack.Nullable;
import org.hyperic.sigar.SigarProxy;
import org.jetbrains.annotations.NotNull;
@@ -90,10 +91,10 @@ public interface EventContext {
/**
* Gets an instance of Sigar. Plugins that need to use Sigar, should use this method to get an instance, rather than
- * instantiating Sigar themselves.
+ * instantiating Sigar themselves. Returns null if the native layer is unavailable or has been disabled.
*
- * @return an instance of Sigar
+ * @return an instance of Sigar, or null if the native layer is unavailable or has been disabled
*/
- @NotNull
+ @Nullable
SigarProxy getSigar();
}
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
index 6fcb6d1..b4e19c4 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -54,6 +54,7 @@ public class LogFileEventPoller implements EventPoller {
private FileInfo logFileInfo;
private LogEntryProcessor entryProcessor;
private EventContext eventContext;
+ private boolean initialized;
public LogFileEventPoller(EventContext eventContext, String eventType, File logFile,
LogEntryProcessor entryProcessor) {
@@ -73,45 +74,54 @@ public class LogFileEventPoller implements EventPoller {
return this.logFile.getPath();
}
- // we can't get the FileInfo in the constructor because pollers are constructed during pc initialization, and
- // at that time the eventManager is not available (and so we can't get sigar).
- private FileInfo getFileInfo() {
- if (null == this.logFileInfo) {
- try {
- SigarProxy sigar = eventContext.getSigar();
- this.logFileInfo = new LogFileInfo(sigar.getFileInfo(logFile.getPath()));
- // once we have the file info we can let go of the event context, just in case that's useful
- this.eventContext = null;
-
- } catch (SigarException e) {
- throw new RuntimeException(e);
- }
- }
-
- return this.logFileInfo;
- }
-
@Nullable
public Set<Event> poll() {
-
+ if (!this.initialized) {
+ init();
+ }
+ if (this.logFileInfo == null) {
+ // This means SIGAR, which we require, is unavailable, so just return null.
+ return null;
+ }
+
if (!this.logFile.exists()) {
- log.warn("Log file [" + this.logFile + "' being polled does not exist.");
+ log.warn("Log file [" + this.logFile + "] being polled does not exist.");
return null;
}
if (this.logFile.isDirectory()) {
- log.error("Log file [" + this.logFile + "' being polled is a directory, not a regular file.");
+ log.error("Log file [" + this.logFile + "] being polled is a directory, not a regular file.");
return null;
}
- FileInfo fileInfo;
- try {
- fileInfo = getFileInfo();
- if (!fileInfo.changed()) {
+
+ try {
+ if (!this.logFileInfo.changed()) {
return null;
}
} catch (SigarException e) {
throw new RuntimeException(e);
}
- return processNewLines(fileInfo);
+ return processNewLines(this.logFileInfo);
+ }
+
+ /**
+ * This performs any initialization that requires using the EventContext. It must *not* be called from our
+ * constructor, because pollers are constructed during PC initialization, and at that time the PC EventManager,
+ * which the EventContext relies on, is not yet available. Instead it is called from {@link #poll()} on the first
+ * invocation of that method, at which point the PC will be initialized.
+ */
+ protected void init() {
+ SigarProxy sigar = this.eventContext.getSigar();
+ if (sigar != null) {
+ try {
+ this.logFileInfo = new LogFileInfo(sigar.getFileInfo(logFile.getPath()));
+ } catch (SigarException e) {
+ throw new RuntimeException("Failed to obtain file info for log file [" + this.logFile + "].", e);
+ }
+ } else {
+ log.warn("SIGAR is unavailable - cannot poll log file [" + this.logFile + "] for events.");
+ }
+
+ this.initialized = true;
}
private Set<Event> processNewLines(FileInfo fileInfo) {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
index 962764a..d134638 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,9 @@ package org.rhq.core.pluginapi.event.log;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -32,10 +35,12 @@ import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pluginapi.event.EventContext;
import org.rhq.core.pluginapi.event.EventPoller;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.system.SystemInfoFactory;
/**
* @author Ian Springer
@@ -47,83 +52,132 @@ public class LogFileEventResourceComponentHelper {
public static final String LOG_EVENT_SOURCE_CONFIG_PROP = "logEventSource";
public abstract static class LogEventSourcePropertyNames {
- public static final String LOG_FILE_PATH = "logFilePath";
- public static final String ENABLED = "enabled";
- public static final String DATE_FORMAT = "dateFormat";
- public static final String INCLUDES_PATTERN = "includesPattern";
- public static final String MINIMUM_SEVERITY = "minimumSeverity";
+ public static final String LOG_FILE_PATH = "logFilePath"; // required
+ public static final String ENABLED = "enabled"; // required
+ public static final String DATE_FORMAT = "dateFormat"; // optional
+ public static final String INCLUDES_PATTERN = "includesPattern"; // optional
+ public static final String MINIMUM_SEVERITY = "minimumSeverity"; // optional
}
+ // TODO: Make this configurable via a plugin config prop.
+ private static final int POLLING_INTERVAL_IN_SECONDS = 60;
+
private final Log log = LogFactory.getLog(this.getClass());
private ResourceContext<?> resourceContext;
+ private List<PropertyMap> startedEventSources = new ArrayList<PropertyMap>();
public LogFileEventResourceComponentHelper(ResourceContext<?> resourceContext) {
this.resourceContext = resourceContext;
}
public void startLogFileEventPollers() {
+ // Grab the list-o-maps of event sources from the plugin config.
Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
PropertyList logEventSources = pluginConfig.getList(LOG_EVENT_SOURCES_CONFIG_PROP);
+
+ // Build a new list containing the event sources that are enabled.
+ List<PropertyMap> enabledEventSources = new ArrayList<PropertyMap>();
for (Property prop : logEventSources.getList()) {
PropertyMap logEventSource = (PropertyMap) prop;
- Boolean enabled = Boolean.valueOf(logEventSource.getSimpleValue(LogEventSourcePropertyNames.ENABLED, null));
- if (enabled) {
- String logFilePathname = logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
- if (logFilePathname == null) {
- log.info("LOGFILE: No logfile path given, can not watch this event log.");
- return;
- }
- File logFile = new File(logFilePathname);
- if (!logFile.exists() || !logFile.canRead()) {
- log.error("LOGFILE: Logfile at location " + logFilePathname
- + " does not exist or is not readable. Can not start watching the event log.");
- return;
- }
+ String enabled = logEventSource.getSimpleValue(LogEventSourcePropertyNames.ENABLED, null);
+ if (enabled == null) {
+ throw new IllegalStateException("Required property [" + LogEventSourcePropertyNames.ENABLED
+ + "] is not defined in map.");
+ }
+ if (Boolean.valueOf(enabled)) {
+ enabledEventSources.add(logEventSource);
+ }
+ }
- Log4JLogEntryProcessor processor = new Log4JLogEntryProcessor(LOG_ENTRY_EVENT_TYPE, logFile);
- String dateFormatString = logEventSource.getSimpleValue(LogEventSourcePropertyNames.DATE_FORMAT, null);
- if (dateFormatString != null) {
- try {
- DateFormat dateFormat = new SimpleDateFormat(dateFormatString); // TODO locale specific ?
- processor.setDateFormat(dateFormat);
- } catch (IllegalArgumentException e) {
- throw new InvalidPluginConfigurationException("Date format [" + dateFormatString
- + "] is not a valid simple date format.");
- }
- }
- String includesPatternString = logEventSource.getSimpleValue(
- LogEventSourcePropertyNames.INCLUDES_PATTERN, null);
- if (includesPatternString != null) {
- try {
- Pattern includesPattern = Pattern.compile(includesPatternString);
- processor.setIncludesPattern(includesPattern);
- } catch (PatternSyntaxException e) {
- throw new InvalidPluginConfigurationException("Includes pattern [" + includesPatternString
- + "] is not a valid regular expression.");
- }
+ // Log a warning then return if SIGAR isn't available, since LogFileEventPoller depends on it. We only log this
+ // warning if at least one event source is enabled, since otherwise the user probably doesn't care.
+ boolean sigarAvailable = this.resourceContext.getSystemInformation().isNative();
+ if (!sigarAvailable && !enabledEventSources.isEmpty()) {
+ boolean nativeSystemInfoDisabled = SystemInfoFactory.isNativeSystemInfoDisabled();
+ ResourceType resourceType = this.resourceContext.getResourceType();
+ List<String> logFilePaths = getLogFilePaths(enabledEventSources);
+ log.warn("Log files " + logFilePaths + " for [" + resourceType.getPlugin() + ":"
+ + resourceType.getName() + "] Resource with key [" + this.resourceContext.getResourceKey()
+ + "] cannot be polled, because log file polling requires RHQ native support, which "
+ + ((nativeSystemInfoDisabled) ? "has been disabled for this Agent" : "is not available on this platform") + ".");
+ return;
+ }
+
+ // Start up log file pollers for each of the enabled event sources.
+ for (PropertyMap logEventSource : enabledEventSources) {
+ String logFilePath = logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
+ if (logFilePath == null) {
+ throw new IllegalStateException("Required property [" + LogEventSourcePropertyNames.LOG_FILE_PATH
+ + "] is not defined in map.");
+ }
+ File logFile = new File(logFilePath);
+ if (!logFile.canRead()) {
+ log.error("LOGFILE: Logfile at location " + logFilePath
+ + " does not exist or is not readable. Can not start watching the event log.");
+ continue;
+ }
+
+ Log4JLogEntryProcessor processor = new Log4JLogEntryProcessor(LOG_ENTRY_EVENT_TYPE, logFile);
+ String dateFormatString = logEventSource.getSimpleValue(LogEventSourcePropertyNames.DATE_FORMAT, null);
+ if (dateFormatString != null) {
+ try {
+ DateFormat dateFormat = new SimpleDateFormat(dateFormatString); // TODO locale specific ?
+ processor.setDateFormat(dateFormat);
+ } catch (IllegalArgumentException e) {
+ throw new InvalidPluginConfigurationException("Date format [" + dateFormatString
+ + "] is not a valid simple date format.");
}
- String minimumSeverityString = logEventSource.getSimpleValue(
- LogEventSourcePropertyNames.MINIMUM_SEVERITY, null);
- if (minimumSeverityString != null) {
- EventSeverity minimumSeverity = EventSeverity.valueOf(minimumSeverityString.toUpperCase());
- processor.setMinimumSeverity(minimumSeverity);
+ }
+ String includesPatternString = logEventSource.getSimpleValue(
+ LogEventSourcePropertyNames.INCLUDES_PATTERN, null);
+ if (includesPatternString != null) {
+ try {
+ Pattern includesPattern = Pattern.compile(includesPatternString);
+ processor.setIncludesPattern(includesPattern);
+ } catch (PatternSyntaxException e) {
+ throw new InvalidPluginConfigurationException("Includes pattern [" + includesPatternString
+ + "] is not a valid regular expression.");
}
- EventContext eventContext = this.resourceContext.getEventContext();
- EventPoller poller = new LogFileEventPoller(eventContext, LOG_ENTRY_EVENT_TYPE, logFile, processor);
- eventContext.registerEventPoller(poller, 60, logFile.getPath());
}
+ String minimumSeverityString = logEventSource.getSimpleValue(
+ LogEventSourcePropertyNames.MINIMUM_SEVERITY, null);
+ if (minimumSeverityString != null) {
+ EventSeverity minimumSeverity = EventSeverity.valueOf(minimumSeverityString.toUpperCase());
+ processor.setMinimumSeverity(minimumSeverity);
+ }
+ EventContext eventContext = this.resourceContext.getEventContext();
+ EventPoller poller = new LogFileEventPoller(eventContext, LOG_ENTRY_EVENT_TYPE, logFile, processor);
+ eventContext.registerEventPoller(poller, POLLING_INTERVAL_IN_SECONDS, logFile.getPath());
+ this.startedEventSources.add(logEventSource);
}
}
public void stopLogFileEventPollers() {
- Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
- PropertyList logEventSources = pluginConfig.getList(LOG_EVENT_SOURCES_CONFIG_PROP);
- for (Property prop : logEventSources.getList()) {
- PropertyMap logEventSource = (PropertyMap) prop;
- String logFilePath = logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
+ boolean sigarAvailable = this.resourceContext.getSystemInformation().isNative();
+ if (!sigarAvailable) {
+ return;
+ }
+
+ for (Iterator<PropertyMap> iterator = this.startedEventSources.iterator(); iterator.hasNext(); ) {
+ PropertyMap logEventSource = iterator.next();
EventContext eventContext = this.resourceContext.getEventContext();
+ String logFilePath = logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
eventContext.unregisterEventPoller(LOG_ENTRY_EVENT_TYPE, logFilePath);
+ iterator.remove();
+ }
+ }
+
+ private List<String> getLogFilePaths(List<PropertyMap> enabledEventSources) {
+ List<String> logFilePaths = new ArrayList<String>(enabledEventSources.size());
+ for (PropertyMap logEventSource : enabledEventSources) {
+ String logFilePath = logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
+ if (logFilePath == null) {
+ throw new IllegalStateException("Required property [" + LogEventSourcePropertyNames.LOG_FILE_PATH
+ + "] is not defined in map.");
+ }
+ logFilePaths.add(logFilePath);
}
+ return logFilePaths;
}
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
index b0b37ec..1735aff 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
@@ -24,6 +24,7 @@ package org.rhq.core.pc.event;
import org.hyperic.sigar.SigarProxy;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.event.Event;
import org.rhq.core.domain.event.EventDefinition;
import org.rhq.core.domain.resource.Resource;
@@ -99,7 +100,7 @@ public class EventContextImpl implements EventContext {
unregisterEventPollerInternal(eventType, sourceLocation);
}
- @NotNull
+ @Nullable
public SigarProxy getSigar() {
return getEventManager().getSigar();
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
index 4ad5c50..87b9bd7 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
@@ -34,6 +34,7 @@ import org.apache.commons.logging.LogFactory;
import org.hyperic.sigar.SigarProxy;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.event.Event;
import org.rhq.core.domain.event.EventDefinition;
import org.rhq.core.domain.event.EventSource;
@@ -44,6 +45,7 @@ import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.pluginapi.event.EventPoller;
import org.rhq.core.system.SigarAccess;
+import org.rhq.core.system.SystemInfoException;
/**
* Manager for the Plugin Container's Event subsystem.
@@ -113,9 +115,12 @@ public class EventManager implements ContainerService {
}
}
+ @Nullable
SigarProxy getSigar() {
if (this.sigar == null) {
- this.sigar = SigarAccess.getSigar();
+ if (SigarAccess.isSigarAvailable()) {
+ this.sigar = SigarAccess.getSigar();
+ }
}
return this.sigar;
}
12 years, 5 months
[rhq] Changes to 'jshaughn/avail'
by Jay Shaughnessy
New branch 'jshaughn/avail' available with the following commits:
commit 93c0e5f42426e4955b07cc66be8feab7e0e39c73
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 10:49:26 2012 -0500
Avail Work In Progress...
- [Bug 701092 - Turning off agent doesn't cause platform to show as down for 15mins]
- Perfom backfilling when agent is shut down cleanly
- Add UNKNOWN avail state for resources not reporting (backfilled)
- Replace agent heartbeat via empty avail reports with new
server service level ping (IN PROGRESS)
- disable comm layer server ping, it is superseded with new ping mechanism
- avail reports will be sent only for non-platform resources
- clock sync check will also be moved from comm layer ping to new ping
- agent will be considered UP only when PC is up (i.e. ping is sent only
when agent can actually report avail, this is basically the same as
before, because avail reporting is performed only when PC is running)
- Add Agent.lastAvailabilityPing field, and use instead of
lastAvailabilityReport for suspect job checking
- drop AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE from 15' to 5'
- for now. maybe can be lower, not sure. or maybe should be calculated
as a factor of ping interval. (e.g. 3*ping interval may be a good
setting, it would allow for a missed or delayed ping but still be
a fairly small setting).
- Rename AgentLastAvailabilityReportComposite to AgentLastAvailabilityPingComposite
commit 02baad11e1a5ff3750d9a8a38d47f440a3b15829
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 10:34:36 2012 -0500
Add JDK tools.jar dep for the build
12 years, 5 months