This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1125439] Duplicate baselines metric entries
Although the root cause is still unknown the relevant code paths did not protect against generating multiple baselines for a single schedule, even though that should be invalid. Here are some changes that are more in line with the 1-1 relationship that should exist between schedule and baseline (optional for schedule, required for baseline) - Make the db index on baseline's scheduleId unique. There should only be one baseline for a schedule. This will prevent the problem in the BZ, possibly at the expense of failure when trying to store a duplicate, but that would perhaps help us pinpoint a problematic code-path. - Use Sets (or a Map) as opposed to Lists in several places in the local API. - Simplify and I think make more efficient the query for selecting schedules without a current baseline. Make it return distinct ids (this is a hedge, I don't think it would return duplicates, but this ensures that constraint). Replace a left join with a NOT EXISTS sub select. - Chunk the storage of baselines to prevent large Txs, don't pass entities across Tx boundary, fetch all Schedules in one query, and (maybe) simplify the entity manager interaction. - Simplify some of the TransactionAttribute decls - Mark MeasurementSchedule.baseline as an optional 1-1 relationship, just to make it explicit on the entity. - Fix some local SLSB jdoc
- Loading branch information
Showing
9 changed files
with
144 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2431,6 +2431,18 @@ | |
<schemaSpec version="2.155"> | ||
<schema-alterColumn table="RHQ_BUNDLE_DESTINATION" column="DEPLOY_DIR" nullable="true"/> | ||
</schemaSpec> | ||
|
||
<schemaSpec version="2.156"> | ||
<schema-directSQL ignoreError="true"> | ||
<statement desc="Dropping non-unique index RHQ_MEAS_BASELINE_SID_IDX"> | ||
DROP INDEX RHQ_MEAS_BASELINE_SID_IDX | ||
</statement> | ||
<statement desc="Recreating RHQ_MEAS_BASELINE_SID_IDX as unique index"> | ||
CREATE UNIQUE INDEX RHQ_MEAS_BASELINE_SID_IDX ON RHQ_MEASUREMENT_BLINE ( SCHEDULE_ID ) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jshaughn
Author
Contributor
|
||
</statement> | ||
</schema-directSQL> | ||
</schemaSpec> | ||
|
||
</dbupgrade> | ||
</target> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 94 additions & 68 deletions
162
...r/src/main/java/org/rhq/enterprise/server/measurement/MeasurementBaselineManagerBean.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This query will fail if the environment fell victim to a duplicate baseline. You need to remove the duplicates if they exist otherwise the upgrade will result in no index at all.
The query that I have tested that will address this is provided but keep in mind that it must be executed before dropping the original index or the query execution time will be greatly increased.