Add debug log that shows up in trace whenever CacheLoader#load is invoked
This allows us to see cache misses in the trace. Change-Id: I7ed1c779c35e6621cabaa6f257289913c92e1fe9 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -179,6 +179,7 @@ public class AccountCacheImpl implements AccountCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<AccountState> load(Account.Id who) throws Exception {
|
public Optional<AccountState> load(Account.Id who) throws Exception {
|
||||||
|
logger.atFine().log("Loading account %s", who);
|
||||||
return accounts.get(who);
|
return accounts.get(who);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ public class GroupCacheImpl implements GroupCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<InternalGroup> load(AccountGroup.Id key) throws Exception {
|
public Optional<InternalGroup> load(AccountGroup.Id key) throws Exception {
|
||||||
|
logger.atFine().log("Loading group %s by ID", key);
|
||||||
return groupQueryProvider.get().byId(key);
|
return groupQueryProvider.get().byId(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,6 +159,7 @@ public class GroupCacheImpl implements GroupCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<InternalGroup> load(String name) throws Exception {
|
public Optional<InternalGroup> load(String name) throws Exception {
|
||||||
|
logger.atFine().log("Loading group '%s' by name", name);
|
||||||
return groupQueryProvider.get().byName(new AccountGroup.NameKey(name));
|
return groupQueryProvider.get().byName(new AccountGroup.NameKey(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,6 +174,7 @@ public class GroupCacheImpl implements GroupCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<InternalGroup> load(String uuid) throws Exception {
|
public Optional<InternalGroup> load(String uuid) throws Exception {
|
||||||
|
logger.atFine().log("Loading group %s by UUID", uuid);
|
||||||
return groups.getGroup(new AccountGroup.UUID(uuid));
|
return groups.getGroup(new AccountGroup.UUID(uuid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ public class GroupIncludeCacheImpl implements GroupIncludeCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableSet<AccountGroup.UUID> load(Account.Id memberId) throws OrmException {
|
public ImmutableSet<AccountGroup.UUID> load(Account.Id memberId) throws OrmException {
|
||||||
|
logger.atFine().log("Loading groups with member %s", memberId);
|
||||||
return groupQueryProvider
|
return groupQueryProvider
|
||||||
.get()
|
.get()
|
||||||
.byMember(memberId)
|
.byMember(memberId)
|
||||||
@@ -168,6 +169,7 @@ public class GroupIncludeCacheImpl implements GroupIncludeCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableList<AccountGroup.UUID> load(AccountGroup.UUID key) throws OrmException {
|
public ImmutableList<AccountGroup.UUID> load(AccountGroup.UUID key) throws OrmException {
|
||||||
|
logger.atFine().log("Loading parent groups of %s", key);
|
||||||
return groupQueryProvider
|
return groupQueryProvider
|
||||||
.get()
|
.get()
|
||||||
.bySubgroup(key)
|
.bySubgroup(key)
|
||||||
@@ -187,6 +189,7 @@ public class GroupIncludeCacheImpl implements GroupIncludeCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableList<AccountGroup.UUID> load(String key) throws Exception {
|
public ImmutableList<AccountGroup.UUID> load(String key) throws Exception {
|
||||||
|
logger.atFine().log("Loading all external groups");
|
||||||
return groups.getExternalGroups().collect(toImmutableList());
|
return groups.getExternalGroups().collect(toImmutableList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ class ExternalIdCacheImpl implements ExternalIdCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllExternalIds load(ObjectId notesRev) throws Exception {
|
public AllExternalIds load(ObjectId notesRev) throws Exception {
|
||||||
|
logger.atFine().log("Loading external IDs (revision=%s)", notesRev);
|
||||||
Multimap<Account.Id, ExternalId> extIdsByAccount =
|
Multimap<Account.Id, ExternalId> extIdsByAccount =
|
||||||
MultimapBuilder.hashKeys().arrayListValues().build();
|
MultimapBuilder.hashKeys().arrayListValues().build();
|
||||||
for (ExternalId extId : externalIdReader.all(notesRev)) {
|
for (ExternalId extId : externalIdReader.all(notesRev)) {
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ class LdapRealm extends AbstractRealm {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<Account.Id> load(String username) throws Exception {
|
public Optional<Account.Id> load(String username) throws Exception {
|
||||||
|
logger.atFine().log("Loading account for username %s", username);
|
||||||
return externalIds
|
return externalIds
|
||||||
.get(ExternalId.Key.create(SCHEME_GERRIT, username))
|
.get(ExternalId.Key.create(SCHEME_GERRIT, username))
|
||||||
.map(ExternalId::accountId);
|
.map(ExternalId::accountId);
|
||||||
@@ -367,6 +368,7 @@ class LdapRealm extends AbstractRealm {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<AccountGroup.UUID> load(String username) throws Exception {
|
public Set<AccountGroup.UUID> load(String username) throws Exception {
|
||||||
|
logger.atFine().log("Loading group for member with username %s", username);
|
||||||
final DirContext ctx = helper.open();
|
final DirContext ctx = helper.open();
|
||||||
try {
|
try {
|
||||||
return helper.queryForGroups(ctx, username, null);
|
return helper.queryForGroups(ctx, username, null);
|
||||||
@@ -386,6 +388,7 @@ class LdapRealm extends AbstractRealm {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean load(String groupDn) throws Exception {
|
public Boolean load(String groupDn) throws Exception {
|
||||||
|
logger.atFine().log("Loading groupDn %s", groupDn);
|
||||||
final DirContext ctx = helper.open();
|
final DirContext ctx = helper.open();
|
||||||
try {
|
try {
|
||||||
Name compositeGroupName = new CompositeName().add(groupDn);
|
Name compositeGroupName = new CompositeName().add(groupDn);
|
||||||
|
|||||||
@@ -235,6 +235,8 @@ public class H2CacheImpl<K, V> extends AbstractLoadingCache<K, V> implements Per
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueHolder<V> load(K key) throws Exception {
|
public ValueHolder<V> load(K key) throws Exception {
|
||||||
|
logger.atFine().log("Loading value for %s from cache", key);
|
||||||
|
|
||||||
if (store.mightContain(key)) {
|
if (store.mightContain(key)) {
|
||||||
ValueHolder<V> h = store.getIfPresent(key);
|
ValueHolder<V> h = store.getIfPresent(key);
|
||||||
if (h != null) {
|
if (h != null) {
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ public class SearchingChangeCacheImpl implements GitReferenceUpdatedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CachedChange> load(Project.NameKey key) throws Exception {
|
public List<CachedChange> load(Project.NameKey key) throws Exception {
|
||||||
|
logger.atFine().log("Loading changes of project %s", key);
|
||||||
try (ManualRequestContext ctx = requestContext.open()) {
|
try (ManualRequestContext ctx = requestContext.open()) {
|
||||||
List<ChangeData> cds =
|
List<ChangeData> cds =
|
||||||
queryProvider
|
queryProvider
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ public class ProjectCacheImpl implements ProjectCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProjectState load(String projectName) throws Exception {
|
public ProjectState load(String projectName) throws Exception {
|
||||||
|
logger.atFine().log("Loading project %s", projectName);
|
||||||
long now = clock.read();
|
long now = clock.read();
|
||||||
Project.NameKey key = new Project.NameKey(projectName);
|
Project.NameKey key = new Project.NameKey(projectName);
|
||||||
try (Repository git = mgr.openRepository(key)) {
|
try (Repository git = mgr.openRepository(key)) {
|
||||||
@@ -298,6 +299,7 @@ public class ProjectCacheImpl implements ProjectCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableSortedSet<Project.NameKey> load(ListKey key) throws Exception {
|
public ImmutableSortedSet<Project.NameKey> load(ListKey key) throws Exception {
|
||||||
|
logger.atFine().log("Loading project list");
|
||||||
return ImmutableSortedSet.copyOf(mgr.list());
|
return ImmutableSortedSet.copyOf(mgr.list());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ public class SshKeyCacheImpl implements SshKeyCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<SshKeyCacheEntry> load(String username) throws Exception {
|
public Iterable<SshKeyCacheEntry> load(String username) throws Exception {
|
||||||
|
logger.atFine().log("Loading SSH keys for account with username %s", username);
|
||||||
|
|
||||||
Optional<ExternalId> user = externalIds.get(ExternalId.Key.create(SCHEME_USERNAME, username));
|
Optional<ExternalId> user = externalIds.get(ExternalId.Key.create(SCHEME_USERNAME, username));
|
||||||
if (!user.isPresent()) {
|
if (!user.isPresent()) {
|
||||||
return NO_SUCH_USER;
|
return NO_SUCH_USER;
|
||||||
|
|||||||
Reference in New Issue
Block a user