You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Jun Rao (JIRA)" <ji...@apache.org> on 2014/04/13 22:22:14 UTC

[jira] [Commented] (KAFKA-1390) TestUtils.waitUntilLeaderIsElectedOrChanged may wait longer than it needs

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

Jun Rao commented on KAFKA-1390:
--------------------------------

A simpler, but probably more practical way is to just keep reading from ZK every 100ms until the expected value is found.

> TestUtils.waitUntilLeaderIsElectedOrChanged may wait longer than it needs
> -------------------------------------------------------------------------
>
>                 Key: KAFKA-1390
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1390
>             Project: Kafka
>          Issue Type: Improvement
>    Affects Versions: 0.8.2
>            Reporter: Jun Rao
>
> The way that waitUntilLeaderIsElectedOrChanged() works is to wait for a ZK callback on leader change. However, if the leader is already elected (and won't change) at the time waitUntilLeaderIsElectedOrChanged() is called, this function will wait for the full timeout, which is unnecessary.



--
This message was sent by Atlassian JIRA
(v6.2#6252)