This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 6e9802b ZOOKEEPER-3378: Set the quorum cnxn timeout independently
from syncLimit
6e9802b is described below
commit 6e9802b440b0c706a035a25aafe40b28d25dfadc
Author: Brian Nixon <[email protected]>
AuthorDate: Mon May 20 23:13:44 2019 +0200
ZOOKEEPER-3378: Set the quorum cnxn timeout independently from syncLimit
Author: Brian Nixon <[email protected]>
Reviewers: Fangmin Lyu <[email protected]>, Enrico Olivelli
<[email protected]>
Closes #932 from enixon/cnx-manager-timeout-2
---
.../src/main/resources/markdown/zookeeperAdmin.md | 9 ++++++++-
.../apache/zookeeper/server/quorum/QuorumCnxManager.java | 2 +-
.../java/org/apache/zookeeper/server/quorum/QuorumPeer.java | 13 ++++++++++++-
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
b/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
index 1c8b9fd..0c36bb4 100644
--- a/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
+++ b/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
@@ -789,7 +789,7 @@ property, when available, is noted below.
dropping.
This parameter defines the interval in milliseconds when the dropping
probability is adjusted. When set to -1, probabilistic dropping is
disabled.
- Default is -1.
+ Default is -1.
* *connectionDropIncrease* :
(Java system property: **zookeeper.connection_throttle_drop_increase**)
@@ -923,6 +923,13 @@ of servers -- that is, when deploying clusters of servers.
###### Note
>Default value is 5 seconds.
+* *quorumCnxnTimeoutMs* :
+ (Java system property: zookeeper.**quorumCnxnTimeoutMs**)
+ Sets the read timeout value for the connections for leader election
notifications.
+ Only applicable if you are using electionAlg 3.
+ ######Note
+ >Default value is -1, which will then use the syncLimit * tickTime as the
timeout.
+
* *standaloneEnabled* :
(No Java system property)
**New in 3.5.0:**
diff --git
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
index 35f3529..1329d20 100644
---
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
+++
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
@@ -804,7 +804,7 @@ public class QuorumCnxManager {
private void setSockOpts(Socket sock) throws SocketException {
sock.setTcpNoDelay(true);
sock.setKeepAlive(tcpKeepAlive);
- sock.setSoTimeout(self.tickTime * self.syncLimit);
+ sock.setSoTimeout(this.socketTimeout);
}
/**
diff --git
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
index 61e4c16..401c7b0 100644
---
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
+++
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
@@ -650,6 +650,14 @@ public class QuorumPeer extends ZooKeeperThread implements
QuorumStats.Provider
*/
protected int quorumCnxnThreadsSize =
QUORUM_CNXN_THREADS_SIZE_DEFAULT_VALUE;
+ public static final String QUORUM_CNXN_TIMEOUT_MS =
"zookeeper.quorumCnxnTimeoutMs";
+ private static int quorumCnxnTimeoutMs;
+
+ static {
+ quorumCnxnTimeoutMs = Integer.getInteger(QUORUM_CNXN_TIMEOUT_MS, -1);
+ LOG.info("{}={}", QUORUM_CNXN_TIMEOUT_MS, quorumCnxnTimeoutMs);
+ }
+
/**
* @deprecated As of release 3.4.0, this class has been deprecated, since
* it is used with one of the udp-based versions of leader election, which
@@ -2293,12 +2301,15 @@ public class QuorumPeer extends ZooKeeperThread
implements QuorumStats.Provider
}
public QuorumCnxManager createCnxnManager() {
+ int timeout = quorumCnxnTimeoutMs > 0 ?
+ quorumCnxnTimeoutMs : this.tickTime * this.syncLimit;
+ LOG.info("Using {}ms as the quorum cnxn socket timeout", timeout);
return new QuorumCnxManager(this,
this.getId(),
this.getView(),
this.authServer,
this.authLearner,
- this.tickTime * this.syncLimit,
+ timeout,
this.getQuorumListenOnAllIPs(),
this.quorumCnxnThreadsSize,
this.isQuorumSaslAuthEnabled());