You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "Ramachandran (Jira)" <ji...@apache.org> on 2022/12/10 09:48:00 UTC

[jira] [Comment Edited] (RANGER-3903) Improvement in RangerPolicyDeltaUtil--> applyDeltas method

    [ https://issues.apache.org/jira/browse/RANGER-3903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17603469#comment-17603469 ] 

Ramachandran edited comment on RANGER-3903 at 12/10/22 9:47 AM:
----------------------------------------------------------------

The review is available :[https://reviews.apache.org/r/74112/]

cc >> [~madhan@apache.org]  [~abhayk]   


was (Author: JIRAUSER295265):
The review is available here -[https://reviews.apache.org/r/74112/]

cc >> [~madhan@apache.org]  [~abhayk]   

> Improvement 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
>            Assignee: Ramachandran
>            Priority: Major
>         Attachments: image-2022-11-08-09-22-05-188.png, image-2022-12-10-13-45-27-181.png, image-2022-12-10-13-46-03-834.png, image-2022-12-10-13-46-36-697.png, image-2022-12-10-13-56-07-135.png, screenshot-1.png
>
>
> After going through the below code snippets in the master branch 
> !screenshot-1.png!
> From the above code, we iterate delta policies and check if this policy exists in the existing policy, we add that to deletePolicies list.
> 1st#Improvement:
> If a delta change type is created, we expect that it should  be in the deletedPolicies list which will not happen.
> So we need to add  changeType == RangerPolicyDelta.CHANGE_TYPE_POLICY_CREATE as part of the below block of code
> !image-2022-11-08-09-22-05-188.png!
>  2nd#Improvement:
> problem:
> !image-2022-12-10-13-56-07-135.png!
> From the above code, we see for each element in the deltas ,we iterate policies and check if this delta policy exists in the existing policy, we add that to deletePolicies list.
> Solution:
> We need to use Map instead of iterating policies for every element of deltas --> Map<Long,List<RangerPolicy>> policiesIdMap
> The building index map key will be policyId and the value will be no of policies associated with the same policy Id
> For  each policy in the deltas ,we check in the policiesIdMap whether the same policyId is present or not ?.
> if yes ,we will add all the associated policy list into  deletePolicies and remove the policyId from policiesIdMap
> After end of the iteration ,we will iterate the policiesIdMap and get all the policylist assicated with policyId and add into result set
> This will give better performance when the policies list is huge.
> !image-2022-12-10-13-45-27-181.png!
> !image-2022-12-10-13-46-03-834.png!
> !image-2022-12-10-13-46-36-697.png!
>  



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