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

Onur Karaman commented on KAFKA-1742:
-------------------------------------

partitionLeadershipInfo and partitionReplicaAssignment are mutable.Maps. Given 
that a mutable.Map may be arbitrarily ordered, dropping the longest prefix of 
elements that satisfy a predicate can cause incorrect results.

It's also noted in the scaladocs 
[http://www.scala-lang.org/api/current/index.html#scala.collection.mutable.Map@dropWhile(p:A=>Boolean):Repr]

For example:
{code}
import collection._

object Main {
  def main(args: Array[String]) {
    var m = mutable.Map(5 -> 2, 3 -> 6)
    println("original: " + m)
    println("using filter: " + m.filter(p => p._1 != 3))
    println("using dropWhile: " + m.dropWhile(p => p._1 == 3))
  }
}
{code}

Outputs:
{code}
original: Map(5 -> 2, 3 -> 6)
using filter: Map(5 -> 2)
using dropWhile: Map(5 -> 2, 3 -> 6)
{code}

> ControllerContext removeTopic does not correctly update state
> -------------------------------------------------------------
>
>                 Key: KAFKA-1742
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1742
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Onur Karaman
>            Assignee: Onur Karaman
>            Priority: Blocker
>             Fix For: 0.8.2
>
>
> removeTopic does not correctly update the state of ControllerContext.
> This is because it removes the topic from some underlying maps through 
> dropWhile.



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

Reply via email to