jolshan commented on code in PR #17822:
URL: https://github.com/apache/kafka/pull/17822#discussion_r1843007260
##########
core/src/test/scala/integration/kafka/api/TransactionsExpirationTest.scala:
##########
@@ -96,14 +101,28 @@ class TransactionsExpirationTest extends
KafkaServerTestHarness {
waitUntilTransactionalStateExists()
waitUntilTransactionalStateExpires()
- // Start a new transaction and attempt to send, which will trigger an
AddPartitionsToTxnRequest, which will fail due to the expired transactional ID.
- producer.beginTransaction()
- val failedFuture =
producer.send(TestUtils.producerRecordWithExpectedTransactionStatus(topic1, 3,
"1", "1", willBeCommitted = false))
- TestUtils.waitUntilTrue(() => failedFuture.isDone, "Producer future never
completed.")
-
- org.apache.kafka.test.TestUtils.assertFutureThrows(failedFuture,
classOf[InvalidPidMappingException])
- producer.abortTransaction()
+ try {
+ // Start a new transaction and attempt to send, which will trigger an
AddPartitionsToTxnRequest,
+ // which will fail due to the expired transactional ID, causing a fatal
error.
+ producer.beginTransaction()
+ val failedFuture =
producer.send(TestUtils.producerRecordWithExpectedTransactionStatus(topic1, 3,
"1", "1", willBeCommitted = false))
+ TestUtils.waitUntilTrue(() => failedFuture.isDone, "Producer future
never completed.")
+
+ org.apache.kafka.test.TestUtils.assertFutureThrows(failedFuture,
classOf[InvalidPidMappingException])
+
+ // Since this is a fatal error, attempting to abort should fail.
+ producer.abortTransaction()
+ } catch {
+ case _: KafkaException =>
Review Comment:
Should we assert we get an error on abort and not have the reinitialization
in a catch block? We want to ensure it happens.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]