> On Aug. 22, 2017, 10:05 p.m., Vamsee Yarlagadda wrote: > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > > Line 1823 (original), 1833 (patched) > > <https://reviews.apache.org/r/61823/diff/1/?file=1801866#file1801866line1833> > > > > Do you think we should see who calls getRolesForGroups() and see if we > > can optimize them all by modifying getRolesForGroups itself?
Yeah we can try. getRolesForGroups() is called by SentryStore#grantOptionCheck(). I can try to follow a SQL like approach for that too and see if it improves performace even more. But I wanted to get this out so I get some feedback before proceeding with more optimization > On Aug. 22, 2017, 10:05 p.m., Vamsee Yarlagadda wrote: > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > > Lines 1836-1840 (patched) > > <https://reviews.apache.org/r/61823/diff/1/?file=1801866#file1801866line1836> > > > > Why can't we optimize this further by asking for all groups at once? > > > > SELECT ... WHERE g.GROUP_NAME IN ('A, 'B'...) > > > > That way we save on computing the same joins over and over? I had tried that. If you look at the comments you will see the "alternate query". The problem is some of the test cases were failing when there were many roles. I think Derby doesn't handle multiple ||'s properly - Arjun ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/61823/#review183536 ----------------------------------------------------------- On Aug. 22, 2017, 9:58 p.m., Arjun Mishra wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/61823/ > ----------------------------------------------------------- > > (Updated Aug. 22, 2017, 9:58 p.m.) > > > Review request for sentry, Alexander Kolbasov, Vamsee Yarlagadda, and Vadim > Spector. > > > Repository: sentry > > > Description > ------- > > Right now when we get privileges from sentry, we pass in a provider like set > of groups. Then we create a MSentryGroup object for each group and then get > roles using the .getRoles() method. However, DataNucleus takes too long and > the fetch doesn't seem to be lazy. This is bad since we only need the > roleNames for the group and not the entire Role object. > Instead running a SQL like query and just getting roleNames will drastically > improve performance > > > Diffs > ----- > > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > d7acaea7c > > > Diff: https://reviews.apache.org/r/61823/diff/1/ > > > Testing > ------- > > > Thanks, > > Arjun Mishra > >
