----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/62261/#review185339 -----------------------------------------------------------
Fix it, then Ship it! sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java Lines 1786 (patched) <https://reviews.apache.org/r/62261/#comment261642> Hope groupNames itself is never null. sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java Lines 1798-1801 (original), 1816-1819 (patched) <https://reviews.apache.org/r/62261/#comment261643> Asking for all groups at once could save multiple hops to the database. ```bash private Set<String> getRoleNamesForGroupsCore(PersistenceManager pm, Set<String> groups) { Query query = pm.newQuery(MSentryGroup.class); query.setFilter(":p1.contains(this.groupName)"); List<MSentryGroup> sentryGroups = (List) query.execute(groups.toArray()); if (sentryGroups.isEmpty()) { return Collections.emptySet(); } Set<String> result = new HashSet<>(); for (MSentryGroup sentryGroup : sentryGroups) { for (MSentryRole role : sentryGroup.getRoles()) { result.add(role.getRoleName()); } } return result; } ``` - Vamsee Yarlagadda On Sept. 13, 2017, 3:49 a.m., Alexander Kolbasov wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/62261/ > ----------------------------------------------------------- > > (Updated Sept. 13, 2017, 3:49 a.m.) > > > Review request for sentry, Arjun Mishra, Brian Towles, Misha Dmitriev, Na Li, > Sergio Pena, and Vamsee Yarlagadda. > > > Bugs: SENTRY-1937 > https://issues.apache.org/jira/browse/SENTRY-1937 > > > Repository: sentry > > > Description > ------- > > SENTRY-1937 Optimize performance for listing sentry roles by group name > > > Diffs > ----- > > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > 01a7c830f548d41062fb3bbd0a81f71514585aa5 > > > Diff: https://reviews.apache.org/r/62261/diff/3/ > > > Testing > ------- > > > Thanks, > > Alexander Kolbasov > >