Add extra logging when replication tasks are merged When two replication tasks are combined they were not previously logged and therefore it was difficult to understand how they were rescheduled and executed. Add extra logging with the information associated with the tasks being combined, so that the Gerrit admin can have a better understanding and easily troubleshoot replication issues. Change-Id: I464405525cf14f4992165d0a82724dac0a9c795a
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 8db73ca..42ecfe1 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
@@ -524,6 +524,12 @@ pendingFetchOp.addStates(fetchOp.getStates()); fetchOp.removeStates(); + stateLog.warn( + String.format( + "[%s] Merging all refs to fetch from [%s] to the already retrying task [%s] for keeping its position into the replication queue", + fetchOp.getTaskIdHex(), fetchOp.getURI(), pendingFetchOp.getTaskIdHex()), + fetchOp.getStatesAsArray()); + } else { // The one pending is one that is NOT retrying, it was just // scheduled believing no problem would happen. The one pending @@ -542,6 +548,12 @@ fetchOp.addRefs(pendingFetchOp.getRefs()); fetchOp.addStates(pendingFetchOp.getStates()); pendingFetchOp.removeStates(); + + stateLog.warn( + String.format( + "[%s] Merging the pending fetch from [%s] with task [%s] and rescheduling", + pendingFetchOp.getTaskIdHex(), pendingFetchOp.getURI(), fetchOp.getTaskIdHex()), + pendingFetchOp.getStatesAsArray()); } }