[ https://issues.apache.org/jira/browse/RANGER-2879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17632099#comment-17632099 ]
Ramachandran edited comment on RANGER-2879 at 11/28/22 10:20 AM: ----------------------------------------------------------------- [~abhay] Will this policies contain the duplicated policy for create/update/delete (appears the same policy Id more than one time)? cc >> [~vel] [~madhan] was (Author: JIRAUSER295265): [~abhay] Will this policies contain the duplicated policy for create/update/delete (appears the same policy Id more than one time)? cc >> Madhan Neethiraj > 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)