Display the in-flight taskId when a runway conflict is detected
When the schedule of a replication task is delayed because
of runway conflict, the in-flight taskId should be logged
so that the Gerrit admin can understand the culprit of replication
delays.
Change-Id: I73b1dd2f4eadd80f473bfd5beb06a5c4c297124a
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 3467460..42bea3e 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
@@ -310,9 +310,10 @@
if (!pool.requestRunway(this)) {
if (!canceled) {
repLog.info(
- "[{}] Rescheduling replication to {} to avoid collision with an in-flight fetch.",
+ "[{}] Rescheduling replication from {} to avoid collision with an in-flight fetch task [{}].",
taskIdHex,
- uri);
+ uri,
+ pool.getInFlight(getURI()).map(FetchOne::getTaskIdHex).orElse("<unknown>"));
pool.reschedule(this, Source.RetryReason.COLLISION);
}
return;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
index 45ab7e2..8db73ca 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
@@ -589,6 +589,10 @@
return true;
}
+ Optional<FetchOne> getInFlight(URIish uri) {
+ return Optional.ofNullable(inFlight.get(uri));
+ }
+
void notifyFinished(FetchOne op) {
synchronized (stateLock) {
inFlight.remove(op.getURI());