Make the replication of deletion more prominent in logs When replicating the deletion of a ref, the logs should not only include the ref name but also the fact that the fetching causes a deletion. Include the "<<DELETED>>" prefix so that the operation is more visible and searchable. Change-Id: I6d5878fa2c8dad1e12c5738c0fcbf0358ff1475d
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchOne.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchOne.java index 69c00f9..86a44a1 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchOne.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchOne.java
@@ -346,7 +346,7 @@ taskIdHex, replicationType, uri, - String.join(",", getRefs())); + getRefSpecs()); Timer1.Context<String> context = metrics.start(config.getName()); try { long startedAt = context.getStartTime();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchRefSpec.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchRefSpec.java index 613b0cf..f85f22a 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchRefSpec.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchRefSpec.java
@@ -43,4 +43,9 @@ public String refName() { return MoreObjects.firstNonNull(getSource(), getDestination()); } + + @Override + public String toString() { + return getSource() == null ? "<<DELETED>>:" + getDestination() : super.toString(); + } }