rajinisivaram commented on a change in pull request #9406: URL: https://github.com/apache/kafka/pull/9406#discussion_r509192752
########## File path: core/src/test/scala/integration/kafka/api/TransactionsWithMaxInFlightOneTest.scala ########## @@ -0,0 +1,131 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package integration.kafka.api + +import java.util.Properties + +import kafka.integration.KafkaServerTestHarness +import kafka.server.KafkaConfig +import kafka.utils.TestUtils +import kafka.utils.TestUtils.consumeRecords +import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.producer.KafkaProducer +import org.junit.{After, Before, Test} +import org.junit.Assert.assertEquals + +import scala.collection.Seq +import scala.collection.mutable.Buffer +import scala.jdk.CollectionConverters._ + +/** + * This is used to test transactions with one broker and `max.in.flight.requests.per.connection=1`. + * A single broker is used to verify edge cases where different requests are queued on the same connection. + */ +class TransactionsWithMaxInFlightOneTest extends KafkaServerTestHarness { Review comment: Yes, the issue this PR fixes is a timing issue that the new unit tests catch, but it is unlikely that we hit it in integration tests. I added this integration test anyway to make sure the fix hasn't broken anything. I was in two minds about whether to check it in, but included anyway since I thought it may help catch regressions with max.in.flight=1 in future. Also, Jenkins builds on slower machines may occasionally hit timing windows we don't usually see otherwise. Don't mind removing if we think it is not worth the maintenance cost. ---------------------------------------------------------------- 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: us...@infra.apache.org