This is an automated email from the ASF dual-hosted git repository.
ijuma pushed a commit to branch 2.0
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/2.0 by this push:
new 1f12433 KAFKA-4041: Update ZooKeeper to 3.4.13 (#5376)
1f12433 is described below
commit 1f124333010ce9007921ea79f8b035acd1c6581a
Author: Ismael Juma <[email protected]>
AuthorDate: Tue Jul 17 13:53:03 2018 -0700
KAFKA-4041: Update ZooKeeper to 3.4.13 (#5376)
This includes a fix for ZOOKEEPER-2184 (Zookeeper Client
should re-resolve hosts when connection attempts fail), which
fixes KAFKA-4041.
Updated a couple of tests as unresolvable addresses are now
retried until the connection timeout. Cleaned up tests a little.
Reviewers: Ewen Cheslack-Postava <[email protected]>, Rajini Sivaram
<[email protected]>
---
.../unit/kafka/server/ServerShutdownTest.scala | 24 +++++++++-------------
.../unit/kafka/zookeeper/ZooKeeperClientTest.scala | 8 ++++----
gradle/dependencies.gradle | 2 +-
3 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala
b/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala
index b402bf9..9f966b4 100755
--- a/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala
+++ b/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala
@@ -22,6 +22,7 @@ import kafka.utils.TestUtils._
import java.io.File
import kafka.log.LogManager
+import kafka.zookeeper.ZooKeeperClientTimeoutException
import org.apache.kafka.clients.consumer.KafkaConsumer
import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord}
import org.apache.kafka.common.errors.KafkaStorageException
@@ -128,9 +129,10 @@ class ServerShutdownTest extends ZooKeeperTestHarness {
@Test
def testCleanShutdownAfterFailedStartup() {
val newProps = TestUtils.createBrokerConfig(0, zkConnect)
- newProps.setProperty("zookeeper.connect",
"some.invalid.hostname.foo.bar.local:65535")
+ newProps.setProperty(KafkaConfig.ZkConnectionTimeoutMsProp, "50")
+ newProps.setProperty(KafkaConfig.ZkConnectProp,
"some.invalid.hostname.foo.bar.local:65535")
val newConfig = KafkaConfig.fromProps(newProps)
- verifyCleanShutdownAfterFailedStartup[IllegalArgumentException](newConfig)
+
verifyCleanShutdownAfterFailedStartup[ZooKeeperClientTimeoutException](newConfig)
}
@Test
@@ -175,23 +177,17 @@ class ServerShutdownTest extends ZooKeeperTestHarness {
}
def verifyNonDaemonThreadsStatus() {
- assertEquals(0, Thread.getAllStackTraces.keySet().toArray
- .map{ _.asInstanceOf[Thread] }
+ assertEquals(0, Thread.getAllStackTraces.keySet.toArray
+ .map(_.asInstanceOf[Thread])
.count(isNonDaemonKafkaThread))
}
@Test
def testConsecutiveShutdown(){
val server = new KafkaServer(config)
- try {
- server.startup()
- server.shutdown()
- server.awaitShutdown()
- server.shutdown()
- assertTrue(true)
- }
- catch{
- case _: Throwable => fail()
- }
+ server.startup()
+ server.shutdown()
+ server.awaitShutdown()
+ server.shutdown()
}
}
diff --git a/core/src/test/scala/unit/kafka/zookeeper/ZooKeeperClientTest.scala
b/core/src/test/scala/unit/kafka/zookeeper/ZooKeeperClientTest.scala
index c4143e2..fcbf699 100644
--- a/core/src/test/scala/unit/kafka/zookeeper/ZooKeeperClientTest.scala
+++ b/core/src/test/scala/unit/kafka/zookeeper/ZooKeeperClientTest.scala
@@ -57,16 +57,16 @@ class ZooKeeperClientTest extends ZooKeeperTestHarness {
System.clearProperty(JaasUtils.JAVA_LOGIN_CONFIG_PARAM)
}
- @Test(expected = classOf[IllegalArgumentException])
+ @Test(expected = classOf[ZooKeeperClientTimeoutException])
def testUnresolvableConnectString(): Unit = {
- new ZooKeeperClient("some.invalid.hostname.foo.bar.local", -1, -1,
Int.MaxValue, time, "testMetricGroup",
- "testMetricType").close()
+ new ZooKeeperClient("some.invalid.hostname.foo.bar.local",
zkSessionTimeout, connectionTimeoutMs = 10,
+ Int.MaxValue, time, "testMetricGroup", "testMetricType").close()
}
@Test(expected = classOf[ZooKeeperClientTimeoutException])
def testConnectionTimeout(): Unit = {
zookeeper.shutdown()
- new ZooKeeperClient(zkConnect, zkSessionTimeout, connectionTimeoutMs =
100, Int.MaxValue, time, "testMetricGroup",
+ new ZooKeeperClient(zkConnect, zkSessionTimeout, connectionTimeoutMs = 10,
Int.MaxValue, time, "testMetricGroup",
"testMetricType").close()
}
diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle
index cbe42c1..fe70302 100644
--- a/gradle/dependencies.gradle
+++ b/gradle/dependencies.gradle
@@ -82,7 +82,7 @@ versions += [
slf4j: "1.7.25",
snappy: "1.1.7.1",
zkclient: "0.10",
- zookeeper: "3.4.12"
+ zookeeper: "3.4.13"
]
libs += [