> On Oct. 10, 2019, 5:23 p.m., Madhan Neethiraj wrote: > > security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java > > Lines 2182 (patched) > > <https://reviews.apache.org/r/71552/diff/2/?file=2167940#file2167940line2182> > > > > It will be more efficient to check for existence using a query like: > > select count(obj.id) from XXPolicy obj where obj.id = :policyId > > > > policyExists() method should check if the value returned from this > > query is > 0. > > > > This will elimiate the need to read entire XXPolicy object from the > > database.
Thanks for the review. I've fixed this in the latest diff. - Andrew ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/71552/#review218186 ----------------------------------------------------------- On Oct. 17, 2019, 7:25 a.m., Andrew Luo wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/71552/ > ----------------------------------------------------------- > > (Updated Oct. 17, 2019, 7:25 a.m.) > > > Review request for ranger. > > > Bugs: RANGER-2594 > https://issues.apache.org/jira/browse/RANGER-2594 > > > Repository: ranger > > > Description > ------- > > Deletion of large policies (those with several thousand users or resources) > is slow - one reason for this is that we fetch the entire policy during > validation, when we only need to check if the policy exists or not. > > > Diffs > ----- > > > agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerPolicyValidator.java > a85410782 > > agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerValidator.java > f31483e97 > > agents-common/src/main/java/org/apache/ranger/plugin/store/ServiceStore.java > ba7407fc4 > security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java > 85db57719 > security-admin/src/main/java/org/apache/ranger/db/XXPolicyDao.java > 06a4063a6 > security-admin/src/main/resources/META-INF/jpa_named_queries.xml 9714fa91b > > > Diff: https://reviews.apache.org/r/71552/diff/3/ > > > Testing > ------- > > Unit tests, and tested end-to-end > > > Thanks, > > Andrew Luo > >
