You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "star (Jira)" <ji...@apache.org> on 2020/06/29 08:06:00 UTC

[jira] [Created] (RANGER-2879) Improve performance of incrementally updating policies

star created RANGER-2879:
----------------------------

             Summary: Improve performance of incrementally updating policies
                 Key: RANGER-2879
                 URL: https://issues.apache.org/jira/browse/RANGER-2879
             Project: Ranger
          Issue Type: Bug
          Components: plugins
    Affects Versions: 2.0.0
            Reporter: star
            Assignee: star


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.3.4#803005)