You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/07/29 07:46:04 UTC

[GitHub] [kafka] abbccdda commented on a change in pull request #9081: KAFKA-10309: KafkaProducer's sendOffsetsToTransaction should not block infinitively

abbccdda commented on a change in pull request #9081:
URL: https://github.com/apache/kafka/pull/9081#discussion_r461313377



##########
File path: core/src/test/scala/integration/kafka/api/TransactionsTest.scala
##########
@@ -406,6 +406,26 @@ class TransactionsTest extends KafkaServerTestHarness {
     TestUtils.waitUntilTrue(() => offsetAndMetadata.equals(consumer.committed(Set(tp).asJava).get(tp)), "cannot read committed offset")
   }
 
+  @Test(expected = classOf[TimeoutException])
+  def testSendOffsetsToTransactionTimeout(): Unit = {
+    val producer = createTransactionalProducer("transactionProducer", maxBlockMs = 1000)
+    producer.initTransactions()
+    producer.beginTransaction()
+    producer.send(new ProducerRecord[Array[Byte], Array[Byte]](topic1, "foo".getBytes, "bar".getBytes))
+
+    for (i <- 0 until servers.size)

Review comment:
       nit: could use servers.indices

##########
File path: core/src/test/scala/integration/kafka/api/TransactionsTest.scala
##########
@@ -406,6 +406,26 @@ class TransactionsTest extends KafkaServerTestHarness {
     TestUtils.waitUntilTrue(() => offsetAndMetadata.equals(consumer.committed(Set(tp).asJava).get(tp)), "cannot read committed offset")
   }
 
+  @Test(expected = classOf[TimeoutException])
+  def testSendOffsetsToTransactionTimeout(): Unit = {
+    val producer = createTransactionalProducer("transactionProducer", maxBlockMs = 1000)
+    producer.initTransactions()
+    producer.beginTransaction()
+    producer.send(new ProducerRecord[Array[Byte], Array[Byte]](topic1, "foo".getBytes, "bar".getBytes))
+
+    for (i <- 0 until servers.size)
+      killBroker(i)
+
+    try {
+      producer.sendOffsetsToTransaction(Map(

Review comment:
       Do we have unit test coverage for other transaction API max blocking as well? Do you mind adding them as separate tests and share the same module?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org