jolshan commented on code in PR #12501: URL: https://github.com/apache/kafka/pull/12501#discussion_r947215689
########## core/src/test/scala/integration/kafka/api/TransactionsExpirationTest.scala: ########## @@ -105,6 +105,36 @@ class TransactionsExpirationTest extends KafkaServerTestHarness { } } + @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ValueSource(strings = Array("zk", "kraft")) + def testTransactionAfterProducerIDExpires(quorum: String): Unit = { + producer.initTransactions() + + // Start and then abort a transaction to allow the producer ID to expire + producer.beginTransaction() + producer.send(TestUtils.producerRecordWithExpectedTransactionStatus(topic1, 0, "2", "2", willBeCommitted = false)) + producer.send(TestUtils.producerRecordWithExpectedTransactionStatus(topic2, 0, "4", "4", willBeCommitted = false)) + producer.abortTransaction() + + // Wait for the producer ID to expire + Thread.sleep(1000) Review Comment: I looked into this more and realized that this test actually checked before the producer IDs were added. To fix this, I added a wait until to make sure the producer IDs are added and it works. However, now I realize that there is a hard-coded `ProducerIdExpirationCheckIntervalMs = 10 * 60 * 1000` in LogManager which makes this a bit harder to test. (The equivalent check interval for transactions is a configuration -- `KafkaConfig.TransactionsRemoveExpiredTransactionalIdCleanupIntervalMsProp`.) I don't think we necessarily need a new configuration here, but I need to think about how I can test this in an integration test. Maybe we don't need to do this here. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org