You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2018/07/17 20:53:09 UTC

[kafka] branch trunk updated: KAFKA-4041: Update ZooKeeper to 3.4.13 (#5376)

This is an automated email from the ASF dual-hosted git repository.

ijuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f6219c6a KAFKA-4041: Update ZooKeeper to 3.4.13 (#5376)
f6219c6a is described below

commit f6219c6ad1d338792413c562615bad22f6baca1c
Author: Ismael Juma <is...@juma.me.uk>
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 <ew...@confluent.io>, Rajini Sivaram <ra...@googlemail.com>
---
 .../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 e5821cb..80af4d8 100644
--- a/gradle/dependencies.gradle
+++ b/gradle/dependencies.gradle
@@ -82,7 +82,7 @@ versions += [
   slf4j: "1.7.25",
   snappy: "1.1.7.2",
   zkclient: "0.10",
-  zookeeper: "3.4.12"
+  zookeeper: "3.4.13"
 ]
 
 libs += [