[
https://issues.apache.org/jira/browse/RANGER-2879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17632099#comment-17632099
]
Ramachandran commented on RANGER-2879:
--------------------------------------
[~abhay] Will this policies contain the same policies list more than once? cc
>> [[email protected]]
> Improve performance of incrementally updating policies
> ------------------------------------------------------
>
> Key: RANGER-2879
> URL: https://issues.apache.org/jira/browse/RANGER-2879
> Project: Ranger
> Issue Type: Improvement
> Components: plugins
> Affects Versions: 2.0.0
> Reporter: star
> Assignee: star
> Priority: Major
>
> There is large amount of deleting policy operation in incrementally updating
> mechanism. But policies in RangerPolicyRepository is a List<RangerPolicy>.
> {code:java}
> //
> private void removePolicy(Long id) {
> if (LOG.isDebugEnabled()) {
> LOG.debug("==> RangerPolicyRepository.removePolicy(" + id +")");
> }
> Iterator<RangerPolicy> iterator = policies.iterator();
> while (iterator.hasNext()) {
> if (id.equals(iterator.next().getId())) {
> iterator.remove();
> break;
> }
> }
> policyEvaluatorsMap.remove(id);
> if (LOG.isDebugEnabled()) {
> LOG.debug("<== RangerPolicyRepository.removePolicy(" + id +")");
> }
> }
> {code}
> Replace list with a map structure will improve performance of removePolicy a
> lot.
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)