yuqi1129 opened a new pull request, #13300:
URL: https://github.com/apache/gravitino/pull/13300

   ### What changes were proposed in this pull request?
   
   - `MetadataAuthzHelper`: remove `preloadOwner`, skip `preloadToCache` for 
entity types the entity cache does not keep, and register parent-scope list 
short-circuits for `MODEL` (`FILTER_MODEL_AUTHORIZATION_EXPRESSION`) and 
`JOB_TEMPLATE` (`LOAD_JOB_TEMPLATE_AUTHORIZATION_EXPRESSION`).
   - `ModelOperations.listModelVersions`: filter the whole version list in one 
`filterByExpression` call instead of one call per version.
   
   ### Why are the changes needed?
   
   `preloadOwner` resolved every listed identifier's id one by one 
(`OwnerMetaService.batchGetOwner` → `EntityIdService.getEntityId`), and for 
non-cacheable types (`MODEL`, `JOB_TEMPLATE`) each resolution is two store 
round trips in their own transactions. Its result has had no consumer since 
#12006 removed relation data from the entity cache. Listing 2,000 models ran 
16,044 SQL statements; 500 job templates 4,064; 1,000 model versions 4,024 (one 
user lookup per version). After this change: 24, 16 and 20 statements; 5,000 
models list in 0.13 s.
   
   Fix: #13299
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   - New tests in `TestMetadataAuthzHelper` (model/job template short-circuit 
hit, deny fallback, no batch get for non-cacheable types, no owner preloading) 
and `TestModelOperations` (all versions filtered in one call, filter result 
honoured).
   - `./gradlew :server-common:test --tests TestMetadataAuthzHelper --tests 
TestPrincipalListQueryCount :server:test --tests TestModelOperations --tests 
TestJobOperations -PskipITs`
   - Manually against PostgreSQL 16 with `log_statement=all`, counting 
statements per list request before/after.
   


-- 
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