summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2015-10-15 13:27:17 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2015-10-15 13:27:17 +0900
commitefa3c6abaaf4ab9469a1a17dd4422d3879230023 (patch)
tree0c7764b33b0e0aa9f762d6bcc88f7bff42643483
parent1fda499fea1052fc7accf96f32a3bb89718a0e0e (diff)
parentaf5edf6047f2a730c5a9fbc6b08dad6edba21dab (diff)
Merge branch 'stable-2.11'
* stable-2.11: Add waiting time and number of retries to replication log Change-Id: If98f8917071715b0d5823a0afa8ceee82c8be723
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java11
1 files changed, 7 insertions, 4 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 6731beb..4a2d01b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
@@ -16,13 +16,13 @@ package com.googlesource.gerrit.plugins.replication;
import static com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog;
-import com.google.common.base.Stopwatch;
import com.google.common.base.Throwables;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
+import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.extensions.events.GitReferenceUpdatedListener;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
@@ -71,7 +71,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
/**
* A push to remote operation started by {@link GitReferenceUpdatedListener}.
@@ -111,6 +110,7 @@ class PushOne implements ProjectRunnable {
private final int maxLockRetries;
private int lockRetryCount;
private final int id;
+ private final long createdAt;
@Inject
PushOne(final GitRepositoryManager grm,
@@ -141,6 +141,7 @@ class PushOne implements ProjectRunnable {
maxLockRetries = pool.getLockErrorMaxRetries();
id = ig.next();
stateLog = sl;
+ createdAt = TimeUtil.nowMs();
}
@Override
@@ -280,13 +281,15 @@ class PushOne implements ProjectRunnable {
return;
}
- Stopwatch stopwatch = Stopwatch.createStarted();
+ long startedAt = TimeUtil.nowMs();
repLog.info("Replication to " + uri + " started...");
try {
git = gitManager.openRepository(projectName);
runImpl();
+ long finishedAt = TimeUtil.nowMs();
repLog.info("Replication to " + uri + " completed in "
- + stopwatch.elapsed(TimeUnit.MILLISECONDS) + " ms");
+ + (finishedAt - startedAt) + "ms, "
+ + (startedAt - createdAt) + "ms delay, " + retryCount + " retries");
} catch (RepositoryNotFoundException e) {
stateLog.error("Cannot replicate " + projectName
+ "; Local repository error: "