Kafka
  1. Kafka
  2. KAFKA-782

replicas not being displayed in TopicMetadataResponse when replica's Broker is shutdown

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.8.0
    • Fix Version/s: None
    • Component/s: replication
    • Labels:
    • Environment:

      Description

      Setup

      • 4 nodes in the cluster
      • topic has 10 partitions, numbered 0-9 in the output below
      • configure the cluster so one of the nodes doesn't hold any leader copies of the partition. I did this by shutting down a node, waiting for reassignment of leaders and starting again

      Output of the TopicMetadataResponse call:

      Partition: 0:vrd01.atlnp1 R:[ vrd03.atlnp1 vrd04.atlnp1 vrd01.atlnp1] I:[ vrd01.atlnp1 vrd03.atlnp1 vrd04.atlnp1]
      Partition: 1:vrd01.atlnp1 R:[ vrd04.atlnp1 vrd01.atlnp1 vrd02.atlnp1] I:[ vrd01.atlnp1 vrd04.atlnp1 vrd02.atlnp1]
      Partition: 2:vrd01.atlnp1 R:[ vrd01.atlnp1 vrd02.atlnp1 vrd03.atlnp1] I:[ vrd01.atlnp1 vrd03.atlnp1 vrd02.atlnp1]
      Partition: 3:vrd03.atlnp1 R:[ vrd02.atlnp1 vrd03.atlnp1 vrd04.atlnp1] I:[ vrd03.atlnp1 vrd04.atlnp1 vrd02.atlnp1]
      Partition: 4:vrd01.atlnp1 R:[ vrd03.atlnp1 vrd01.atlnp1 vrd02.atlnp1] I:[ vrd01.atlnp1 vrd03.atlnp1 vrd02.atlnp1]
      Partition: 5:vrd03.atlnp1 R:[ vrd04.atlnp1 vrd02.atlnp1 vrd03.atlnp1] I:[ vrd03.atlnp1 vrd04.atlnp1 vrd02.atlnp1]
      Partition: 6:vrd01.atlnp1 R:[ vrd01.atlnp1 vrd03.atlnp1 vrd04.atlnp1] I:[ vrd01.atlnp1 vrd03.atlnp1 vrd04.atlnp1]
      Partition: 7:vrd01.atlnp1 R:[ vrd02.atlnp1 vrd04.atlnp1 vrd01.atlnp1] I:[ vrd01.atlnp1 vrd04.atlnp1 vrd02.atlnp1]
      Partition: 8:vrd03.atlnp1 R:[ vrd03.atlnp1 vrd02.atlnp1 vrd04.atlnp1] I:[ vrd03.atlnp1 vrd04.atlnp1 vrd02.atlnp1]
      Partition: 9:vrd01.atlnp1 R:[ vrd04.atlnp1 vrd03.atlnp1 vrd01.atlnp1] I:[ vrd01.atlnp1 vrd03.atlnp1 vrd04.atlnp1]

      Note that vrd02.atlnp1 does not contain any leader replicas.

      Shutdown vrd02 normally. Run TopicMetadataResponse again:

      Partition: 0:vrd01.atlnp1 R:[ vrd03.atlnp1 vrd04.atlnp1 vrd01.atlnp1] I:[ vrd01.atlnp1 vrd03.atlnp1 vrd04.atlnp1]
      Partition: 1:vrd01.atlnp1 R:[ ] I:[]
      Partition: 2:vrd01.atlnp1 R:[ ] I:[]
      Partition: 3:vrd03.atlnp1 R:[ ] I:[]
      Partition: 4:vrd01.atlnp1 R:[ ] I:[]
      Partition: 5:vrd03.atlnp1 R:[ ] I:[]
      Partition: 6:vrd01.atlnp1 R:[ vrd01.atlnp1 vrd03.atlnp1 vrd04.atlnp1] I:[ vrd01.atlnp1 vrd03.atlnp1 vrd04.atlnp1]
      Partition: 7:vrd01.atlnp1 R:[ ] I:[]
      Partition: 8:vrd03.atlnp1 R:[ ] I:[]
      Partition: 9:vrd01.atlnp1 R:[ vrd04.atlnp1 vrd03.atlnp1 vrd01.atlnp1] I:[ vrd01.atlnp1 vrd03.atlnp1 vrd04.atlnp1]

      Note that the partitions where vrd02 was in the replica set no longer show any replicas.

      Not clear if the list of replicas isn't being set correctly or the replicas aren't associated with the partition any longer.

      Java code:

      kafka.javaapi.consumer.SimpleConsumer consumer = new SimpleConsumer("vrd01.atlnp1",
      9092,
      100000,
      64 * 1024, "test");

      List<String> topics2 = new ArrayList<String>();
      topics2.add("storm-anon");
      TopicMetadataRequest req = new TopicMetadataRequest(topics2);
      kafka.javaapi.TopicMetadataResponse resp = consumer.send(req);

      List<kafka.javaapi.TopicMetadata> data3 = resp.topicsMetadata();

      for (kafka.javaapi.TopicMetadata item : data3) {

      for (kafka.javaapi.PartitionMetadata part: item.partitionsMetadata() ) {
      String replicas = "";
      String isr = "";

      for (kafka.cluster.Broker replica: part.replicas() )

      { replicas += " " + replica.host(); }

      for (kafka.cluster.Broker replica: part.isr() )

      { isr += " " + replica.host(); }

      System.out.println( "Partition: " + part.partitionId() + ":" + part.leader().host() + " R:[ " + replicas + "] I:[" + isr + "]");
      }
      }

        Activity

        Chris Curtin created issue -
        Hide
        Chris Curtin added a comment -

        Confirmed same behavior with 0.8.0 HEAD as of 3/4/2013

        Show
        Chris Curtin added a comment - Confirmed same behavior with 0.8.0 HEAD as of 3/4/2013
        Neha Narkhede made changes -
        Field Original Value New Value
        Labels kafka-0.8 p2
        Hide
        Neha Narkhede added a comment -

        This is probably fixed by now, can you retry ?

        Show
        Neha Narkhede added a comment - This is probably fixed by now, can you retry ?
        Hide
        Chris Curtin added a comment -

        I tested with the 0.8.0 HEAD as of 4/30/2013 and the issue is resolved. Thanks.

        Show
        Chris Curtin added a comment - I tested with the 0.8.0 HEAD as of 4/30/2013 and the issue is resolved. Thanks.
        Neha Narkhede made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Neha Narkhede made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Neha Narkhede
            Reporter:
            Chris Curtin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development