Skip to content

KAFKA-19516: Added a request timeout of 120000ms to CreateTopics in ShareFetchAcknolwedgeRequestTest methods #20184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import org.apache.kafka.common.test.ClusterInstance
import org.apache.kafka.common.utils.ProducerIdAndEpoch
import org.apache.kafka.controller.ControllerRequestContextUtil.ANONYMOUS_CONTEXT
import org.apache.kafka.server.IntegrationTestUtils
import org.junit.jupiter.api.Assertions.{assertEquals, fail}
import org.junit.jupiter.api.Assertions.{assertDoesNotThrow, assertEquals, fail}

import java.net.Socket
import java.util
Expand Down Expand Up @@ -123,16 +123,35 @@ class GroupCoordinatorBaseRequestTest(cluster: ClusterInstance) {
topicConfig: Properties = new Properties
): Map[TopicIdPartition, Int] = {
val admin = cluster.admin()
var partitionToLeader: scala.collection.immutable.Map[Int, Int] = null
try {
val partitionToLeader = TestUtils.createTopicWithAdmin(
admin = admin,
topic = topic,
brokers = brokers(),
controllers = controllerServers(),
numPartitions = numPartitions,
replicationFactor = replicationFactor,
topicConfig = topicConfig
TestUtils.waitUntilTrue(
condition = () => {
try {
partitionToLeader = TestUtils.createTopicWithAdmin(
admin = admin,
topic = topic,
brokers = brokers(),
controllers = controllerServers(),
numPartitions = numPartitions,
replicationFactor = replicationFactor,
topicConfig = topicConfig
)
true // Success
} catch {
case _: Throwable => false // Will retry
}
},
msg = "Failed to create topic with admin within 2 minutes",
waitTimeMs = 2 * 60 * 1000, // 2 minutes in milliseconds
pause = 40 * 1000 // 40 seconds in milliseconds
Comment on lines +145 to +147
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, why does the CreateTopic operation sometimes take up to 2 minutes to succeed? Is there a configuration that controls this behavior?

)
admin
.describeTopics(TopicCollection.ofTopicNames(List(topic).asJava))
.allTopicNames()
.get()
.get(topic)
.topicId()
partitionToLeader.map { case (partition, leader) => new TopicIdPartition(getTopicIds.get(topic), new TopicPartition(topic, partition)) -> leader }
} finally {
admin.close()
Expand Down
Loading