-
-
Notifications
You must be signed in to change notification settings - Fork 888
Revisit catalog usage override impl #2057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…TargetTierDefinition Previous implementation relied on sql `concat` method which seem to prevent sql engine from using an index. The new implementation simplifies the logic by looking at the first block only (with the assumption) and all blocks within a tier should provide the matching tier (if this were not the case previous impl would anyway fail to return the entry).
…TargetUsageDefinition Previous implementation relied on sql `concat` method which seem to prevent sql engine from using an index. This is similar to what we did in 5eaef9b Note however that previous CatalogOverrideUsageTierSqlDao#getTargetUsageDefinition would return a list of `Long` indicating that we could have different tiers across different usage sections. I can't seem to understand the use case and how the code was handling this anyways, so after much thinking and additional tests, i removed this (what to seem unused)complexity.
…tTargetPhaseDefinition Previous implementation relied on sql `concat` method which seem to prevent sql engine from using an index. This is exactlyvsimilar to what we did in 6f3e16a incl the change of signature from a list of Long to a Long.
…TargetPlanDefinition Previous implementation relied on sql `concat` method which seem to prevent sql engine from using an index. This is exactlyvsimilar to what we did in 6f3e16a incl the change of signature from a list of Long to a Long.
| final CatalogOverridePlanPhaseSqlDao sqlDao = inTransactionHandle.attach(CatalogOverridePlanPhaseSqlDao.class); | ||
|
|
||
| final List<String> keys = new ArrayList<String>(); | ||
| if (overridePhaseDefinitionModelDaos.length == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: not required (loop wouldn't have any element to go through).
| final CatalogOverridePhaseUsageSqlDao sqlDao = inTransactionHandle.attach(CatalogOverridePhaseUsageSqlDao.class); | ||
|
|
||
| final List<String> keys = new ArrayList<String>(); | ||
| if (overrideUsageDefinitionModelDaos.length == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: same remark.
| final CatalogOverrideUsageTierSqlDao sqlDao = inTransactionHandle.attach(CatalogOverrideUsageTierSqlDao.class); | ||
|
|
||
| final List<String> keys = new ArrayList<String>(); | ||
| if (overrideTierDefinitionModelDaos.length == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: same remark.
| final CatalogOverrideTierBlockSqlDao sqlDao = inTransactionHandle.attach(CatalogOverrideTierBlockSqlDao.class); | ||
|
|
||
| final List<String> keys = new ArrayList<String>(); | ||
| if (overrideBlockDefinitionModelDaos.length == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: same remark.
This PR attempts to address some performance issues that were reported when a large number of entries have been inserted in the catalog tables to override some usage sections.
Additional tests have been written to minimize potential effect for the change on existing data but certainly not bullet proof. Details is in each commits.