Add debug logs for accessing star labels that show up in debug trace
In a trace we want to be able to see all meta data reads and writes. Example logs: [2018-08-14 11:08:42,063] [HTTP-77] DEBUG com.google.gerrit.server.StarredChangesUtil : Read star labels of account 1000000 [CONTEXT forced=true TRACE_ID="1534237722016-fdceadbc" ] [2018-08-14 11:08:42,064] [HTTP-77] DEBUG com.google.gerrit.server.StarredChangesUtil : Update star labels of account 1000000 (labels=[star]) [CONTEXT forced=true TRACE_ID="1534237722016-fdceadbc" ] Change-Id: I3ba17345af039b174194a9aceddd9d80ce7f9574 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -376,6 +376,8 @@ public class StarredChangesUtil {
|
||||
}
|
||||
|
||||
public static StarRef readLabels(Repository repo, String refName) throws IOException {
|
||||
logger.atFine().log("Read star labels from %s", refName);
|
||||
|
||||
Ref ref = repo.exactRef(refName);
|
||||
if (ref == null) {
|
||||
return StarRef.MISSING;
|
||||
@@ -448,6 +450,7 @@ public class StarredChangesUtil {
|
||||
private void updateLabels(
|
||||
Repository repo, String refName, ObjectId oldObjectId, Collection<String> labels)
|
||||
throws IOException, OrmException, InvalidLabelsException {
|
||||
logger.atFine().log("Update star labels in %s (labels=%s)", refName, labels);
|
||||
try (RevWalk rw = new RevWalk(repo)) {
|
||||
RefUpdate u = repo.updateRef(refName);
|
||||
u.setExpectedOldObjectId(oldObjectId);
|
||||
@@ -485,6 +488,7 @@ public class StarredChangesUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.atFine().log("Delete star labels in %s", refName);
|
||||
RefUpdate u = repo.updateRef(refName);
|
||||
u.setForceUpdate(true);
|
||||
u.setExpectedOldObjectId(oldObjectId);
|
||||
|
Reference in New Issue
Block a user