Partially revert GroupDetail to fix Admin > Groups issues

Loading Admin > Groups on a large server is horribly slow because
someone thought it was a good idea to reuse GroupDetail in
fccf928042. That caused the entire
group membership database to be downloaded to the browser when
showing just the list of groups, only to have the data discarded and
reloaded after selecting a specific group to view. If a server has
7k users and 17k groups, it could take ages to show the groups list.

Strip out GroupDetail and switch back to the more lightweight
AccountGroup type when showing the groups in a list format.

Since there are only 3 SYSTEM groups using well known names, and
everything else returned is of type INTERNAL because the LDAP type
no longer exists, drop the type column from the table, it isn't
really interesting anymore.

This change does drop the Owner group name column header. Displaying
it can really slow down on large servers when there are a lot of
groups. So skip displaying the owner name. Its more important to me
that the Admin > Groups table doesn't download the entire database
than having the owner group resolved in the list view. If someone
really cares enough, they can reattempt what fccf928042 was trying
to accomplish, without downloading the entire membership database.

Change-Id: I884a5129d238b7aaaf6db8a886e7c0a49f73cf74
This commit is contained in:
Shawn O. Pearce
2012-08-01 12:30:49 -07:00
parent 0dbb8188a2
commit 7e031f38f7
8 changed files with 34 additions and 55 deletions

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.sshd.commands;
import com.google.gerrit.common.data.GroupDetail;
import com.google.gerrit.common.data.GroupList;
import com.google.gerrit.common.errors.NoSuchGroupException;
import com.google.gerrit.reviewdb.client.Account;
@@ -26,7 +25,6 @@ import com.google.gerrit.server.ioutil.ColumnFormatter;
import com.google.gerrit.server.project.ProjectControl;
import com.google.gerrit.sshd.SshCommand;
import com.google.gwtorm.client.KeyUtil;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import org.kohsuke.args4j.Option;
@@ -84,8 +82,7 @@ public class ListGroupsCommand extends SshCommand {
}
final ColumnFormatter formatter = new ColumnFormatter(stdout, '\t');
for (final GroupDetail groupDetail : groupList.getGroups()) {
final AccountGroup g = groupDetail.group;
for (final AccountGroup g : groupList.getGroups()) {
formatter.addColumn(g.getName());
if (verboseOutput) {
formatter.addColumn(KeyUtil.decode(g.getGroupUUID().toString()));
@@ -102,8 +99,6 @@ public class ListGroupsCommand extends SshCommand {
formatter.nextLine();
}
formatter.finish();
} catch (OrmException e) {
throw die(e);
} catch (NoSuchGroupException e) {
throw die(e);
}