Pearl1594 opened a new pull request, #13566:
URL: https://github.com/apache/cloudstack/pull/13566

   ### Description
   
   This PR Adds a fast-path for listTemplates Phase 1 that bypasses 
template_view,
   behind a runtime config flag (default off).
   
   ### Why
   
   The captured incident query against template_view runs 7,000+ seconds and
   drains the DB pool. View materializes ~71k rows for ~4.7k templates due to
   LEFT-JOIN row multiplication, OR-join on data_center, and predicates on a
   computed column. Phase 1 only needs 6 of the 13 tables.
   
   ### What changed
   
     - `BypassTemplateView` ConfigKey (`template.list.bypass.view`, default 
`false`,
       Global, runtime-toggleable).
     - `TemplateListFilter` POJO + `canBypass()` predicate.
     - `TemplateJoinDao.findDistinctTempZonePairs(filter)` — hand-tuned SQL over
       vm_template + account + template_store_ref + image_store + 
template_zone_ref
       + data_center; OR-join replaced with `COALESCE`.
     - `QueryManagerImpl` builds the filter and dispatches to bypass when flag 
is
       on AND `canBypass()` is true. Otherwise falls through to existing path.
   
   ### Coverage
   
     Bypass handles: `id`, `name`, `keyword`, `hypervisor`, `format`, `type`,
     `public`, `featured`, `bootable`, `parenttemplateid`, `accountType`,
     `accountIdIN`, `zoneid`, `templateState`, `removed`, `onlyReady`, 
pagination,
     `templatefilter` ∈ {`self`/`selfexecutable` non-domain-admin, `executable`,
     `all` admin}.
   
     Falls back to view path: `tags`, `templatefilter` ∈ {`featured`, 
`community`,
     `sharedexecutable`, `shared`, `all` non-admin, `self`/`selfexecutable` for
     DOMAIN_ADMIN/RESOURCE_DOMAIN_ADMIN}.
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally 
changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to 
reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be 
closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- 
******************************************************************************* 
-->
   <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE 
DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- 
******************************************************************************* 
-->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [X] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] Build/CI
   - [ ] Test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to 
-->
   
   #### How did you try to break this feature and the system with this change?
   
   <!-- see how your change affects other areas of the code, etc. -->
   
   <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) 
document -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to