[ 
https://issues.apache.org/jira/browse/FLINK-20068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17229763#comment-17229763
 ] 

Jiangjie Qin commented on FLINK-20068:
--------------------------------------

This is a legacy issue caused by asynchronous topic creation in Kafka.

The problems is that we have 3 Kafka brokers. When a topic is created, the 
{{CreateTopicsRequest}} will be sent to one of the brokers and block waiting 
until that broker receives a metadata cache update. However, this does not 
guarantee that the other two brokers have also received the metadata cache 
update. When a subsequent TopicMetadataRequest goes to the other two brokers, 
it is still possible that the topic being created is not returned in the topic 
metadata.

The patch fixes this by letting the {{KafkaTestEnvironmentImpl}} to look into 
each of the brokers and wait until all the brokers have got the newly created 
topic in their metadata cache before it returns from {{createTestTopic()}} call.

This should help fix a few other intermittent test failures.

> KafkaSubscriberTest.testTopicPatternSubscriber failed with unexpected results
> -----------------------------------------------------------------------------
>
>                 Key: FLINK-20068
>                 URL: https://issues.apache.org/jira/browse/FLINK-20068
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / Kafka
>    Affects Versions: 1.12.0
>            Reporter: Dian Fu
>            Priority: Blocker
>              Labels: pull-request-available, test-stability
>             Fix For: 1.12.0
>
>
> https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=9365&view=logs&j=c5f0071e-1851-543e-9a45-9ac140befc32&t=1fb1a56f-e8b5-5a82-00a0-a2db7757b4f5
> {code}
> 2020-11-10T00:14:22.7658242Z [ERROR] 
> testTopicPatternSubscriber(org.apache.flink.connector.kafka.source.enumerator.subscriber.KafkaSubscriberTest)
>   Time elapsed: 0.012 s  <<< FAILURE!
> 2020-11-10T00:14:22.7659838Z java.lang.AssertionError: 
> expected:<[pattern-topic-5, pattern-topic-4, pattern-topic-7, 
> pattern-topic-6, pattern-topic-9, pattern-topic-8, pattern-topic-1, 
> pattern-topic-0, pattern-topic-3]> but was:<[]>
> 2020-11-10T00:14:22.7660740Z  at org.junit.Assert.fail(Assert.java:88)
> 2020-11-10T00:14:22.7661245Z  at 
> org.junit.Assert.failNotEquals(Assert.java:834)
> 2020-11-10T00:14:22.7661788Z  at 
> org.junit.Assert.assertEquals(Assert.java:118)
> 2020-11-10T00:14:22.7662312Z  at 
> org.junit.Assert.assertEquals(Assert.java:144)
> 2020-11-10T00:14:22.7663051Z  at 
> org.apache.flink.connector.kafka.source.enumerator.subscriber.KafkaSubscriberTest.testTopicPatternSubscriber(KafkaSubscriberTest.java:94)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to