Ramachandran created RANGER-3903:
------------------------------------

             Summary: Improvements in RangerPolicyDeltaUtil--> applyDeltas 
method
                 Key: RANGER-3903
                 URL: https://issues.apache.org/jira/browse/RANGER-3903
             Project: Ranger
          Issue Type: Improvement
          Components: Ranger
    Affects Versions: 3.0.0
            Reporter: Ramachandran


 

 
{code:java}
while (iter.hasNext()) {
    RangerPolicy policy = iter.next();
    if (policyId.equals(policy.getId()) && (changeType == 
RangerPolicyDelta.CHANGE_TYPE_POLICY_DELETE || changeType == 
RangerPolicyDelta.CHANGE_TYPE_POLICY_UPDATE)) {
        deletedPolicies.add(policy);
        iter.remove();
    }
}
  {code}
 

 

>From the above code, we iterate delta policies and check if this policy exists 
>in the existing policy, we add that to deletePolicies.

If a delta change type is created, we expect that it should not be in the 
existing old policy which should not have happened. If it happens to be found, 
we log a warning. 
And if the change type is updated, then it should be in deleted Policy, so if 
it is empty, we log a warning that is not expected here. Same for delete.

Proposal :
The same id can be for multiple policies here.?
If policy Id is uniqiue and found a match, why are still we iterating here 
instead of adding a break 

 

 



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

Reply via email to