[ 
https://issues.apache.org/jira/browse/KAFKA-19782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18047279#comment-18047279
 ] 

Evgeny Kuvardin commented on KAFKA-19782:
-----------------------------------------

[~lianetm] could you help us out?

We accidentally created two PRs for the same task, and we’ll actually be 
working together on it going forward.
Right now we have a question about which approach is better.

Could you coordinate us a bit and take a look at both PRs?

In your opinion, which option is better to use? Both approaches work.

Also I want to discuss some benchmarks and remove several

> Improve perfomance Authorizer.authorizeByResourceType by using Prefix Trie
> --------------------------------------------------------------------------
>
>                 Key: KAFKA-19782
>                 URL: https://issues.apache.org/jira/browse/KAFKA-19782
>             Project: Kafka
>          Issue Type: Improvement
>          Components: clients
>            Reporter: Evgeny Kuvardin
>            Assignee: Guang Zhao
>            Priority: Minor
>
> Class Authorizer.authorizeByResourceType under the hood uses HashMap for 
> check if the caller is authorized to perform the given ACL operation on at 
> least one resource of the given type.
> It check each character in allowPatterns and pass to deny patterns
> {code:java}
> // For any literal allowed, if there's no dominant literal and prefix denied, 
> return allow.
>         // For any prefix allowed, if there's no dominant prefix denied, 
> return allow.
>         for (Map.Entry<PatternType, Set<String>> entry : 
> allowPatterns.entrySet()) {
>             for (String allowStr : entry.getValue()) {
>                 if (entry.getKey() == PatternType.LITERAL
>                         && 
> denyPatterns.get(PatternType.LITERAL).contains(allowStr))
>                     continue;
>                 StringBuilder sb = new StringBuilder();
>                 boolean hasDominatedDeny = false;
>                 for (char ch : allowStr.toCharArray()) {
>                     sb.append(ch);
>                     if 
> (denyPatterns.get(PatternType.PREFIXED).contains(sb.toString())) {
>                         hasDominatedDeny = true;
>                         break;
>                     }
>                 }
>                 if (!hasDominatedDeny)
>                     return AuthorizationResult.ALLOWED;
>             }
>         }
> {code}
> To improve performance better use Prefix Tree



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to