summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2015-11-12 17:52:02 -0800
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2015-11-12 17:52:02 -0800
commit675d9dd370948f0508dbe536dfc65cc6cd3bb00d (patch)
treee075c3e1009c12954f5ad69d9f1842f3761acc7c
parent32e84b1b6131230caf880b0c181f98551edc44c6 (diff)
parent6ee0a32f594c42a656e9080083e924b34779a4ab (diff)
Merge branch 'stable-2.11' into stable-2.12v2.12-rc2v2.12-rc1v2.12
* stable-2.11: Destination: parse replication delay and retry as time units Remove obsolete remote.NAME.timeout from config documentation Change-Id: I57016ead4f30def6153b66dee41922cddad36804
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java13
-rw-r--r--src/main/resources/Documentation/config.md23
2 files changed, 16 insertions, 20 deletions
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
index 5e04bb9..ee8d08d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
@@ -29,6 +29,7 @@ import com.google.gerrit.server.PluginUser;
import com.google.gerrit.server.account.GroupBackend;
import com.google.gerrit.server.account.GroupBackends;
import com.google.gerrit.server.account.ListGroupMembership;
+import com.google.gerrit.server.config.ConfigUtil;
import com.google.gerrit.server.config.RequestScopedReviewDbProvider;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.PerThreadRequestScope;
@@ -107,8 +108,10 @@ class Destination {
gitManager = gitRepositoryManager;
this.stateLog = stateLog;
- delay = Math.max(0, getInt(rc, cfg, "replicationdelay", 15));
- retryDelay = Math.max(0, getInt(rc, cfg, "replicationretry", 1));
+ delay = Math.max(0,
+ getTimeUnit(rc, cfg, "replicationdelay", 15, TimeUnit.SECONDS));
+ retryDelay = Math.max(0,
+ getTimeUnit(rc, cfg, "replicationretry", 1, TimeUnit.MINUTES));
lockErrorMaxRetries = cfg.getInt("replication", "lockErrorMaxRetries", 0);
adminUrls = cfg.getStringList("remote", rc.getName(), "adminUrl");
urls = cfg.getStringList("remote", rc.getName(), "url");
@@ -204,6 +207,12 @@ class Destination {
return cfg.getInt("remote", rc.getName(), name, defValue);
}
+ private static int getTimeUnit(
+ RemoteConfig rc, Config cfg, String name, int defValue, TimeUnit unit) {
+ return (int)ConfigUtil.getTimeUnit(
+ cfg, "remote", rc.getName(), name, defValue, unit);
+ }
+
private boolean isVisible(final Project.NameKey project,
ReplicationState... states) {
try {
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index bea2d92..54251ce 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -182,31 +182,18 @@ remote.NAME.push
[2]: #example_file
-remote.NAME.timeout
-: Number of seconds to wait for a network read or write to
- complete before giving up and declaring the remote side is not
- responding. If 0, there is no timeout, and the push client
- waits indefinitely.
-
- A timeout should be large enough to mostly transfer the
- objects to the other side. 1 second may be too small for
- larger projects, especially over a WAN link, while 10-30
- seconds is a much more reasonable timeout value.
-
- Defaults to 0 seconds, wait indefinitely.
-
remote.NAME.replicationDelay
-: Number of seconds to wait before scheduling a remote push
- operation. Setting the delay to 0 effectively disables the
- delay, causing the push to start as soon as possible.
+: Time to wait before scheduling a remote push operation. Setting
+ the delay to 0 effectively disables the delay, causing the push
+ to start as soon as possible.
This is a Gerrit specific extension to the Git remote block.
By default, 15 seconds.
remote.NAME.replicationRetry
-: Number of minutes to wait before scheduling a remote push
- operation previously failed due to an offline remote server.
+: Time to wait before scheduling a remote push operation previously
+ failed due to an offline remote server.
If a remote push operation fails because a remote server was
offline, all push operations to the same destination URL are