Skip to content
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

Fix test flakes in TestKafkaTransportProvider #599

Merged
merged 2 commits into from May 7, 2019
Merged

Fix test flakes in TestKafkaTransportProvider #599

merged 2 commits into from May 7, 2019

Conversation

akaritakai
Copy link
Contributor

@akaritakai akaritakai commented May 7, 2019

Checking for the topic's existence using AdminUtils.topicExists(..) isn't enough to guarantee that the topic is ready for production, allowing a race condition to exist.

When we lose the race condition, the test fails like this:

WARN  NetworkClient:968 - [Producer clientId=testClient] Error while fetching metadata with correlation id 2 : {testTopic_1=UNKNOWN_TOPIC_OR_PARTITION}
INFO  Metadata:285 - Cluster ID: ...
INFO  Log:66 - [Log partition=testTopic_1-0, dir=...] Loading producer state till offset 0 with message format version 2
INFO  Log:66 - [Log partition=testTopic_1-0, dir=...] Completed load of log with 1 segments, log start offset 0 and log end offset 0 in ... ms
INFO  LogManager:66 - Created log for partition testTopic_1-0 in ... with properties ...
INFO  Partition:66 - [Partition testTopic_1-0 broker=2] No checkpointed highwatermark is found for partition testTopic_1-0
WARN  KafkaTransportProvider:test:0:261 - sent failure due to org.apache.kafka.common.errors.UnknownTopicOrPartitionException: This server does not host this topic-partition.

As we can see, the broker is still setting everything up when the producer makes the metadata request, so the produce request fails. This failure also results in the test's KafkaProducer closing, making retries not possible in the current configuration.

A simple fix is to ensure that the topic is consumable (and thus is set up on the broker) before we try to produce to it, which is what this PR does.

groelofs
groelofs previously approved these changes May 7, 2019
Copy link

@groelofs groelofs left a comment

Choose a reason for hiding this comment

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

LGTM

ahmedahamid
ahmedahamid previously approved these changes May 7, 2019
Copy link
Collaborator

@ahmedahamid ahmedahamid left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you, @akaritakai.

Copy link
Collaborator

@ahmedahamid ahmedahamid left a comment

Choose a reason for hiding this comment

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

Thanks again

@akaritakai akaritakai requested review from groelofs and removed request for celiakung May 7, 2019 05:40
Copy link
Contributor

@lhaiesp lhaiesp left a comment

Choose a reason for hiding this comment

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

LGTM

@akaritakai akaritakai merged commit c9002e8 into linkedin:master May 7, 2019
@akaritakai akaritakai deleted the fix-test-flakes branch May 7, 2019 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants