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

Rajini Sivaram commented on KAFKA-2089:
---------------------------------------

Jiangjie Qin, 
Thank you for the review. I had a look at the code in KafkaProducer. It was a 
good observation that the MetadataTest code is similar to the code used in 
KafkaProducer. 

I dont believe there is a timing issue in the code in KafkaProducer since the 
call to requestUpdate always results in an metadata update in the network 
thread. The problem with MetadataTest was that there was no timing relationship 
between the actual update in the main thread and the requestUpdate() call in 
the async thread. And that introduced a timing window.

Since the MetadataTest code is similar to the product code in KafkaProducer, I 
think the test would be more useful if it reflected the logic in KafkaProducer. 
This would also close the timing window in the test, but it would leave the 
test logic similar to product code logic. I have submitted a new patch where 
the update in the main thread in the test is triggered by the call to 
requestUpdate in the async thread, making the test similar to metadata updates 
in KafkaProducer. 

Have run the test in a loop for 100K runs and it works fine.

> MetadataTest transient failure
> ------------------------------
>
>                 Key: KAFKA-2089
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2089
>             Project: Kafka
>          Issue Type: Sub-task
>    Affects Versions: 0.8.3
>            Reporter: Jun Rao
>            Assignee: Rajini Sivaram
>         Attachments: KAFKA-2089.patch, KAFKA-2089.patch
>
>
> org.apache.kafka.clients.MetadataTest > testMetadata FAILED
>     java.lang.AssertionError:
>         at org.junit.Assert.fail(Assert.java:91)
>         at org.junit.Assert.assertTrue(Assert.java:43)
>         at org.junit.Assert.assertFalse(Assert.java:68)
>         at org.junit.Assert.assertFalse(Assert.java:79)
>         at 
> org.apache.kafka.clients.MetadataTest.tearDown(MetadataTest.java:34)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to