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
This commit is contained in:
Alice Kober-Sotzek
2017-10-12 14:44:17 +02:00
committed by David Ostrovsky
parent c115d626f1
commit f87dca186b
5 changed files with 30 additions and 20 deletions

View File

@@ -61,12 +61,12 @@ Intended for interactive use only.
adv_bases | | | | adv_bases | | | |
changes | | 27.1ms | 0% | changes | | 27.1ms | 0% |
groups | 5646 | 11.8ms | 97% | groups | 5646 | 11.8ms | 97% |
groups_byinclude | 230 | 2.4ms | 62% |
groups_bymember | | | | groups_bymember | | | |
groups_byname | | | | groups_byname | | | |
groups_bysubgroup | 230 | 2.4ms | 62% |
groups_byuuid | 5612 | 29.2ms | 99% | groups_byuuid | 5612 | 29.2ms | 99% |
groups_external | 1 | 1.5s | 98% | groups_external | 1 | 1.5s | 98% |
groups_members | 5714 | 19.7ms | 99% | groups_subgroups | 5714 | 19.7ms | 99% |
ldap_group_existence | | | | ldap_group_existence | | | |
ldap_groups | 650 | 680.5ms | 99% | ldap_groups | 650 | 680.5ms | 99% |
ldap_groups_byinclude | 1024 | | 83% | ldap_groups_byinclude | 1024 | | 83% |

View File

@@ -847,18 +847,18 @@ including the group owner, name, and description.
External group membership obtained from LDAP is cached under External group membership obtained from LDAP is cached under
`"ldap_groups"`. `"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"`:: cache `"groups_bymember"`::
+ +
Caches the groups which contain a specific member (account). If direct Caches the groups which contain a specific member (account). If direct
updates are made to the `account_group_members` table, this cache should updates are made to the `account_group_members` table, this cache should
be flushed. 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 Caches subgroups. If direct updates are made to the
`account_group_includes` table, this cache should be flushed. `account_group_includes` table, this cache should be flushed.

View File

@@ -333,11 +333,6 @@ The entries in the map are sorted by cache name.
"mem": 12 "mem": 12
} }
}, },
"groups_byinclude": {
"type": "MEM",
"entries": {},
"hit_ratio": {}
},
"groups_bymember": { "groups_bymember": {
"type": "MEM", "type": "MEM",
"entries": {}, "entries": {},
@@ -348,6 +343,11 @@ The entries in the map are sorted by cache name.
"entries": {}, "entries": {},
"hit_ratio": {} "hit_ratio": {}
}, },
"groups_bysubgroup": {
"type": "MEM",
"entries": {},
"hit_ratio": {}
},
"groups_byuuid": { "groups_byuuid": {
"type": "MEM", "type": "MEM",
"entries": { "entries": {
@@ -363,7 +363,7 @@ The entries in the map are sorted by cache name.
"entries": {}, "entries": {},
"hit_ratio": {} "hit_ratio": {}
}, },
groups_members": { groups_subgroups": {
"type": "MEM", "type": "MEM",
"entries": { "entries": {
"mem": 4 "mem": 4
@@ -472,12 +472,12 @@ The cache names are lexicographically sorted.
"diff_intraline", "diff_intraline",
"git_tags", "git_tags",
"groups", "groups",
"groups_byinclude",
"groups_bymember", "groups_bymember",
"groups_byname", "groups_byname",
"groups_bysubgroup",
"groups_byuuid", "groups_byuuid",
"groups_external", "groups_external",
"groups_members", "groups_subgroups",
"permission_sort", "permission_sort",
"plugin_resources", "plugin_resources",
"project_list", "project_list",

View File

@@ -29,10 +29,20 @@ public interface GroupIncludeCache {
*/ */
Collection<AccountGroup.UUID> getGroupsWithMember(Account.Id memberId); 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); 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); Collection<AccountGroup.UUID> parentGroupsOf(AccountGroup.UUID groupId);
/** @return set of any UUIDs that are not internal groups. */ /** @return set of any UUIDs that are not internal groups. */

View File

@@ -52,8 +52,8 @@ import org.slf4j.LoggerFactory;
@Singleton @Singleton
public class GroupIncludeCacheImpl implements GroupIncludeCache { public class GroupIncludeCacheImpl implements GroupIncludeCache {
private static final Logger log = LoggerFactory.getLogger(GroupIncludeCacheImpl.class); private static final Logger log = LoggerFactory.getLogger(GroupIncludeCacheImpl.class);
private static final String PARENT_GROUPS_NAME = "groups_byinclude"; private static final String PARENT_GROUPS_NAME = "groups_bysubgroup";
private static final String SUBGROUPS_NAME = "groups_members"; private static final String SUBGROUPS_NAME = "groups_subgroups";
private static final String GROUPS_WITH_MEMBER_NAME = "groups_bymember"; private static final String GROUPS_WITH_MEMBER_NAME = "groups_bymember";
private static final String EXTERNAL_NAME = "groups_external"; private static final String EXTERNAL_NAME = "groups_external";