summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNasser Grainawi <nasser@codeaurora.org>2021-02-25 12:54:14 -0700
committerNasser Grainawi <nasser@codeaurora.org>2021-02-25 12:54:14 -0700
commit14766e75f91886ab48951035d59a78c8c3f07471 (patch)
tree10f222f20e290e3a68dc73dd2a88ea481995127d
parenta379adcd2f4f1a41731818e74b2a214de3fcf5d8 (diff)
parent2f69b53b8c64b696d6819b4355ea3ac76d8f1293 (diff)
Merge branch 'stable-3.3'
* stable-3.3: Call retryDone() when giving up after lock failures Fix issue with task cleanup after retry Change-Id: Ib2216e3b06ea62cb06c22ad955a8c252f3bacccc
-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.java40
2 files changed, 21 insertions, 20 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 404d4bd..87c35ee 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
@@ -468,6 +468,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 e508b32..e2e1e21 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStorageIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStorageIT.java
@@ -250,26 +250,6 @@ public class ReplicationStorageIT extends ReplicationStorageDaemon {
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);
@@ -332,6 +312,26 @@ public class ReplicationStorageIT extends ReplicationStorageDaemon {
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();