Do not notify failures on collisions Currently, when a replication task is rescheduled due to a collision, it is not marked as a retry. However, the failure notification logic only suppresses notifications for tasks explicitly flagged as retries. This change adds an additional check to prevent failure notifications for tasks that are rescheduled because of collisions. The same logic was applied to the replication plugin with change Ibf1ca6247. Bug: Issue 418811956 Change-Id: If489f6b9ac4cdb307a4332bbf23dcf2b51f5178a
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 9b72b6d..e83590a 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
@@ -88,6 +88,7 @@ private final Set<TransportException> fetchFailures = Sets.newHashSetWithExpectedSize(4); private boolean fetchAllRefs; private Repository git; + private boolean isCollision; private boolean retrying; private int retryCount; private final int maxRetries; @@ -259,7 +260,7 @@ } private void statesCleanUp() { - if (!stateMap.isEmpty() && !isRetrying()) { + if (!stateMap.isEmpty() && !isRetrying() && !isCollision) { for (Map.Entry<String, ReplicationState> entry : stateMap.entries()) { entry .getValue() @@ -315,6 +316,7 @@ // we start replication (instead a new instance, with the same URI, is // created and scheduled for a future point in time.) // + isCollision = false; if (replicationType == ReplicationType.ASYNC && !pool.requestRunway(this)) { if (!canceled) { repLog.info( @@ -323,6 +325,7 @@ uri, pool.getInFlight(getURI()).map(FetchOne::getTaskIdHex).orElse("<unknown>")); pool.reschedule(this, Source.RetryReason.COLLISION); + isCollision = true; } return; }