kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [kafka] branch trunk updated: KAFKA-6234; Increased timeout value for lowWatermark response to fix transient failures (#4238)
Date Thu, 12 Apr 2018 22:45:54 GMT
This is an automated email from the ASF dual-hosted git repository.

jgus 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 886daf5  KAFKA-6234; Increased timeout value for lowWatermark response to fix transient
failures (#4238)
886daf5 is described below

commit 886daf5fca70846ad0ce5b85f2522cf08b08ee44
Author: Sönke Liebau <soenke.liebau@opencore.com>
AuthorDate: Fri Apr 13 00:45:38 2018 +0200

    KAFKA-6234; Increased timeout value for lowWatermark response to fix transient failures
(#4238)
    
    Removed timeout from get call that caused the test to fail occasionally, this will instead
fall back to the wrapping waitUntilTrue timeout. Also added unnesting of exceptions from ExecutionException
that was originally missing and put the retrieved value for lowWatermark in the fail message
for better readability in case of test failure.
    
    Reviewers: Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>
---
 .../kafka/api/AdminClientIntegrationTest.scala      | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala b/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
index c59fe6d..33c14c6 100644
--- a/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
+++ b/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
@@ -38,7 +38,7 @@ import org.apache.kafka.common.{KafkaFuture, TopicPartition, TopicPartitionRepli
 import org.apache.kafka.common.acl._
 import org.apache.kafka.common.config.ConfigResource
 import org.apache.kafka.common.errors._
-import org.junit.{After, Before, Ignore, Rule, Test}
+import org.junit.{After, Before, Rule, Test}
 import org.apache.kafka.common.requests.{DeleteRecordsRequest, MetadataResponse}
 import org.apache.kafka.common.resource.{Resource, ResourceType}
 import org.junit.rules.Timeout
@@ -741,7 +741,6 @@ class AdminClientIntegrationTest extends IntegrationTestHarness with Logging
{
   }
 
   @Test
-  @Ignore // Disabled temporarily until flakiness is resolved
   def testLogStartOffsetCheckpoint(): Unit = {
     createTopic(topic, numPartitions = 2, replicationFactor = serverCount)
 
@@ -751,8 +750,8 @@ class AdminClientIntegrationTest extends IntegrationTestHarness with Logging
{
 
     sendRecords(producers.head, 10, topicPartition)
     var result = client.deleteRecords(Map(topicPartition -> RecordsToDelete.beforeOffset(5L)).asJava)
-    var lowWatermark = result.lowWatermarks().get(topicPartition).get().lowWatermark()
-    assertEquals(5L, lowWatermark)
+    var lowWatermark: Option[Long] = Some(result.lowWatermarks.get(topicPartition).get.lowWatermark)
+    assertEquals(Some(5), lowWatermark)
 
     for (i <- 0 until serverCount) {
       killBroker(i)
@@ -767,16 +766,16 @@ class AdminClientIntegrationTest extends IntegrationTestHarness with
Logging {
       // Need to retry if leader is not available for the partition
       result = client.deleteRecords(Map(topicPartition -> RecordsToDelete.beforeOffset(0L)).asJava)
 
+      lowWatermark = None
       val future = result.lowWatermarks().get(topicPartition)
       try {
-        lowWatermark = future.get(1000L, TimeUnit.MILLISECONDS).lowWatermark()
-        lowWatermark == 5L
+        lowWatermark = Some(future.get.lowWatermark)
+        lowWatermark.contains(5L)
       } catch {
-        case e: LeaderNotAvailableException => false
-      }
-
-    }, "Expected low watermark of the partition to be 5L")
-
+        case e: ExecutionException if e.getCause.isInstanceOf[LeaderNotAvailableException]
||
+          e.getCause.isInstanceOf[NotLeaderForPartitionException] => false
+        }
+    }, s"Expected low watermark of the partition to be 5 but got ${lowWatermark.getOrElse("no
response within the timeout")}")
     client.close()
   }
 

-- 
To stop receiving notification emails like this one, please contact
jgus@apache.org.

Mime
View raw message