Improve naming of group caches
Throughout Gerrit, the members of a group always refer to accounts.
For some reason, the cache for the subgroups of a group also used the
term 'members'. To reduce confusion (especially with the newly
introduced cache for the groups which contain a specific account), we
change the name of the caches relating to subgroups.
Change-Id: I8e1e4e91045f9f4769c75e7c48e57a019ac97069
diff --git a/Documentation/cmd-show-caches.txt b/Documentation/cmd-show-caches.txt
index 1c9c7e9..6a1f554 100644
--- a/Documentation/cmd-show-caches.txt
+++ b/Documentation/cmd-show-caches.txt
@@ -61,12 +61,12 @@
adv_bases | | | |
changes | | 27.1ms | 0% |
groups | 5646 | 11.8ms | 97% |
- groups_byinclude | 230 | 2.4ms | 62% |
groups_bymember | | | |
groups_byname | | | |
+ groups_bysubgroup | 230 | 2.4ms | 62% |
groups_byuuid | 5612 | 29.2ms | 99% |
groups_external | 1 | 1.5s | 98% |
- groups_members | 5714 | 19.7ms | 99% |
+ groups_subgroups | 5714 | 19.7ms | 99% |
ldap_group_existence | | | |
ldap_groups | 650 | 680.5ms | 99% |
ldap_groups_byinclude | 1024 | | 83% |
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index 7a59fa1..d241b98 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -847,18 +847,18 @@
External group membership obtained from LDAP is cached under
`"ldap_groups"`.
-cache `"groups_byinclude"`::
-+
-Caches group inclusions in other groups. If direct updates are made
-to the `account_group_includes` table, this cache should be flushed.
-
cache `"groups_bymember"`::
+
Caches the groups which contain a specific member (account). If direct
updates are made to the `account_group_members` table, this cache should
be flushed.
-cache `"groups_members"`::
+cache `"groups_bysubgroups"`::
++
+Caches the parent groups of a subgroup. If direct updates are made
+to the `account_group_includes` table, this cache should be flushed.
+
+cache `"groups_subgroups"`::
+
Caches subgroups. If direct updates are made to the
`account_group_includes` table, this cache should be flushed.
diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt
index f1e9126..320e848 100644
--- a/Documentation/rest-api-config.txt
+++ b/Documentation/rest-api-config.txt
@@ -333,11 +333,6 @@
"mem": 12
}
},
- "groups_byinclude": {
- "type": "MEM",
- "entries": {},
- "hit_ratio": {}
- },
"groups_bymember": {
"type": "MEM",
"entries": {},
@@ -348,6 +343,11 @@
"entries": {},
"hit_ratio": {}
},
+ "groups_bysubgroup": {
+ "type": "MEM",
+ "entries": {},
+ "hit_ratio": {}
+ },
"groups_byuuid": {
"type": "MEM",
"entries": {
@@ -363,7 +363,7 @@
"entries": {},
"hit_ratio": {}
},
- groups_members": {
+ groups_subgroups": {
"type": "MEM",
"entries": {
"mem": 4
@@ -472,12 +472,12 @@
"diff_intraline",
"git_tags",
"groups",
- "groups_byinclude",
"groups_bymember",
"groups_byname",
+ "groups_bysubgroup",
"groups_byuuid",
"groups_external",
- "groups_members",
+ "groups_subgroups",
"permission_sort",
"plugin_resources",
"project_list",
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/GroupIncludeCache.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/GroupIncludeCache.java
index daa431e..157afb8 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/GroupIncludeCache.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/GroupIncludeCache.java
@@ -29,10 +29,20 @@
*/
Collection<AccountGroup.UUID> getGroupsWithMember(Account.Id memberId);
- /** @return groups directly a member of the passed group. */
+ /**
+ * Returns the subgroups of a group.
+ *
+ * @param group the UUID of the group
+ * @return the UUIDs of all direct subgroups
+ */
Collection<AccountGroup.UUID> subgroupsOf(AccountGroup.UUID group);
- /** @return any groups the passed group belongs to. */
+ /**
+ * Returns the parent groups of a subgroup.
+ *
+ * @param groupId the UUID of the subgroup
+ * @return the UUIDs of all direct parent groups
+ */
Collection<AccountGroup.UUID> parentGroupsOf(AccountGroup.UUID groupId);
/** @return set of any UUIDs that are not internal groups. */
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/GroupIncludeCacheImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/GroupIncludeCacheImpl.java
index cfb14c54..e128627 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/GroupIncludeCacheImpl.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/GroupIncludeCacheImpl.java
@@ -52,8 +52,8 @@
@Singleton
public class GroupIncludeCacheImpl implements GroupIncludeCache {
private static final Logger log = LoggerFactory.getLogger(GroupIncludeCacheImpl.class);
- private static final String PARENT_GROUPS_NAME = "groups_byinclude";
- private static final String SUBGROUPS_NAME = "groups_members";
+ private static final String PARENT_GROUPS_NAME = "groups_bysubgroup";
+ private static final String SUBGROUPS_NAME = "groups_subgroups";
private static final String GROUPS_WITH_MEMBER_NAME = "groups_bymember";
private static final String EXTERNAL_NAME = "groups_external";