[
https://issues.apache.org/jira/browse/KNOX-3585?focusedWorklogId=1055530&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1055530
]
ASF GitHub Bot logged work on KNOX-3585:
----------------------------------------
Author: ASF GitHub Bot
Created on: 18/Nov/26 05:14
Start Date: 18/Nov/26 05:14
Worklog Time Spent: 10m
Work Description: handavid opened a new pull request, #1522:
URL: https://github.com/apache/knox/pull/1522
[KNOX-3585](https://issues.apache.org/jira/browse/KNOX-3585) - Optimize
roles retrieval
## What changes were proposed in this pull request?
Track the number of roles last seen by the LDAPRolesLookupInterceptor. If
the number of entries is larger than the number of roles, then retrieve all
roles. If the number of entries is smaller than the number of roles, then
retrieve the roles for each entry through the roles lookup API.
Add a @VisibleForTesting setNumRoles seam so tests can pin which strategy
handleSearch selects, and cover the list strategy (listRoles plus one
lookupRoleAssignees per role) added for large result sets: user and group role
resolution, dedup, id lowercasing, per-role failure handling, and the numRoles
threshold flipping a later smaller search back to the lookup path.
## How was this patch tested?
Ran updated unit tests
Ran workflow tests, workflow tests with role lookup, and workflow tests with
rest role lookup
Manually tested against file-based role lookup by running multiple ldap
searches for all users, single user, all groups
## Integration Tests
Integration tests were run, but no new tests were implemented. This
functionality results in the same output as before. It is better covered by the
unit tests.
## UI changes
No UI changes
Issue Time Tracking
-------------------
Worklog Id: (was: 1055530)
Remaining Estimate: 0h
Time Spent: 10m
> Optimize roles lookup for large result sets
> -------------------------------------------
>
> Key: KNOX-3585
> URL: https://issues.apache.org/jira/browse/KNOX-3585
> Project: Apache Knox
> Issue Type: Improvement
> Components: LDAP
> Affects Versions: 3.0.0
> Reporter: David Han
> Assignee: David Han
> Priority: Major
> Fix For: 3.1.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The roles lookup interceptor makes a lookup call for each user entry. If the
> entry set is large, this may result in 1000s of calls to the roles lookup
> server before the results are returned.
> If the number of results are greater than the number of roles, it would be
> faster to retrieve all roles from the role server and perform the mapping in
> the roles lookup interceptor.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)