summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNasser Grainawi <nasser@codeaurora.org>2021-02-25 12:16:57 -0700
committerNasser Grainawi <nasser@codeaurora.org>2021-02-25 12:16:57 -0700
commitcc72dc5cb3e4198ebd4f487a3fcc04846e1ceb43 (patch)
treed5a0b14954cc4b07fd6497075a90fdb9e7135375
parenta5636087cb17a3d4d2450736d6382da682cc1fa9 (diff)
parent17e8c41d5e7b83c419a52a6f7da0ad3ade514f76 (diff)
Merge branch 'stable-3.1' into stable-3.2v3.2.9v3.2.8v3.2.14v3.2.13v3.2.12v3.2.11v3.2.10
* stable-3.1: Call retryDone() when giving up after lock failures Fix issue with task cleanup after retry Change-Id: I6dbeaa0d21545a1903bdb11c5de5d9e8f72079c5
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java1
-rw-r--r--src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStorageIT.java44
2 files changed, 23 insertions, 22 deletions
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
index bdef2fa..ebc8889 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
@@ -414,6 +414,7 @@ class PushOne implements ProjectRunnable, CanceledWhileRunning, UriUpdates {
pool.reschedule(this, Destination.RetryReason.TRANSPORT_ERROR);
}
} else {
+ retryDone();
repLog.atSevere().log(
"Giving up after %d '%s' failures during replication to %s",
updateRefRetryCount, e.getMessage(), uri);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStorageIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStorageIT.java
index dd584ce..31a4f49 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStorageIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStorageIT.java
@@ -51,8 +51,8 @@ import org.junit.Test;
name = "replication",
sysModule = "com.googlesource.gerrit.plugins.replication.ReplicationModule")
public class ReplicationStorageIT extends ReplicationDaemon {
- private static final int TEST_TASK_FINISH_SECONDS = 1;
- private static final int TEST_REPLICATION_MAX_RETRIES = 1;
+ protected static final int TEST_TASK_FINISH_SECONDS = 1;
+ protected static final int TEST_REPLICATION_MAX_RETRIES = 1;
protected static final Duration TEST_TASK_FINISH_TIMEOUT =
Duration.ofSeconds(TEST_TASK_FINISH_SECONDS);
private static final Duration MAX_RETRY_WITH_TOLERANCE_TIMEOUT =
@@ -270,26 +270,6 @@ public class ReplicationStorageIT extends ReplicationDaemon {
replicateBranchDeletion(false);
}
- private void replicateBranchDeletion(boolean mirror) throws Exception {
- setReplicationDestination("foo", "replica", ALL_PROJECTS);
- reloadConfig();
-
- Project.NameKey targetProject = createTestProject(project + "replica");
- String branchToDelete = "refs/heads/todelete";
- String master = "refs/heads/master";
- BranchInput input = new BranchInput();
- input.revision = master;
- gApi.projects().name(project.get()).branch(branchToDelete).create(input);
- isPushCompleted(targetProject, branchToDelete, TEST_PUSH_TIMEOUT);
-
- setReplicationDestination("foo", "replica", ALL_PROJECTS, Integer.MAX_VALUE, mirror);
- reloadConfig();
-
- gApi.projects().name(project.get()).branch(branchToDelete).delete();
-
- assertThat(listWaitingReplicationTasks(branchToDelete)).hasSize(1);
- }
-
@Test
public void shouldCleanupTasksAfterNewProjectReplication() throws Exception {
setReplicationDestination("task_cleanup_project", "replica", ALL_PROJECTS);
@@ -352,6 +332,26 @@ public class ReplicationStorageIT extends ReplicationDaemon {
WaitUtil.waitUntil(() -> isTaskCleanedUp(), TEST_TASK_FINISH_TIMEOUT);
}
+ private void replicateBranchDeletion(boolean mirror) throws Exception {
+ setReplicationDestination("foo", "replica", ALL_PROJECTS);
+ reloadConfig();
+
+ Project.NameKey targetProject = createTestProject(project + "replica");
+ String branchToDelete = "refs/heads/todelete";
+ String master = "refs/heads/master";
+ BranchInput input = new BranchInput();
+ input.revision = master;
+ gApi.projects().name(project.get()).branch(branchToDelete).create(input);
+ isPushCompleted(targetProject, branchToDelete, TEST_PUSH_TIMEOUT);
+
+ setReplicationDestination("foo", "replica", ALL_PROJECTS, Integer.MAX_VALUE, mirror);
+ reloadConfig();
+
+ gApi.projects().name(project.get()).branch(branchToDelete).delete();
+
+ assertThat(listWaitingReplicationTasks(branchToDelete)).hasSize(1);
+ }
+
private boolean isTaskRescheduled(QueueInfo queue, URIish uri) {
PushOne pushOne = queue.pending.get(uri);
return pushOne == null ? false : pushOne.isRetrying();