[
https://issues.apache.org/jira/browse/KNOX-3587?focusedWorklogId=1055570&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1055570
]
ASF GitHub Bot logged work on KNOX-3587:
----------------------------------------
Author: ASF GitHub Bot
Created on: 18/Nov/26 07:47
Start Date: 18/Nov/26 07:47
Worklog Time Spent: 10m
Work Description: hsheinblatt opened a new pull request, #1524:
URL: https://github.com/apache/knox/pull/1524
KNOX-3587 - Read delegation policies in a single query on the token-exchange
evaluation path
## What changes were proposed in this pull request?
Previously, reading one delegation policy issued a query per child row.
selectByActor() and
selectById() ran the core SELECT and then one query for users, one for
groups, one for resources,
and one per resource for that resource's scopes, so a single read cost 4 + R
statements for a
policy holding R resources. selectAll() called the same assembler once per
row, costing
1 + N * (3 + R) statements to list N policies. A policy can hold an
unbounded number of users,
groups, resources and scopes, so both paths scaled with the data rather than
with the request.
selectByActor() is on the token-exchange path and runs once per delegation
exchange.
Policies are now read in one statement, and listed in a fixed number of
statements:
selectByActor() 4 + R -> 1
selectById() 4 + R -> 1
selectAll() 1 + N * (3 + R) -> 1 + 4 * ceil(N / 1000)
DelegationPolicyDatabase:
* buildSelectPolicySql(String predicate) assembles the whole-policy read as
five UNION ALL
branches
Issue Time Tracking
-------------------
Worklog Id: (was: 1055570)
Remaining Estimate: 0h
Time Spent: 10m
> The delegation policy lookup should be a single query
> -----------------------------------------------------
>
> Key: KNOX-3587
> URL: https://issues.apache.org/jira/browse/KNOX-3587
> Project: Apache Knox
> Issue Type: Sub-task
> Components: JWT
> Reporter: Harrison Sheinblatt
> Assignee: Harrison Sheinblatt
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Currently the delegation policy lookup does one query of the base table then
> follow on queries of additional tables rather than a single join query. There
> should be only one round trip to the DB on the hot path.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)