You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "Madhan Neethiraj (Jira)" <ji...@apache.org> on 2022/12/10 07:27:00 UTC
[jira] [Commented] (RANGER-2879) Improve performance of incrementally updating policies
[ https://issues.apache.org/jira/browse/RANGER-2879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17645567#comment-17645567 ]
Madhan Neethiraj commented on RANGER-2879:
------------------------------------------
[~ramackri] - {{RangerPolicyRepository.policies}} wouldn't contain entries with duplicate IDs.
> 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)