Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-1503

all partitions are using same broker as their leader after broker is down

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.8.0, 0.8.1.1
    • Fix Version/s: 0.8.2.0
    • Component/s: controller
    • Labels:
    • Environment:
      0.8.1.1

      Description

      The current leader selection always pick the first live broker in ISR when the current leader broker is down. Since the list of liveBrokerInIsr is not evenly distributed. As time goes on, all the partitions will use only one broker as its leader.

      I figured out a fix which is to use the first live broker in replica list which is also in ISR list. Since the liveAssignedReplicas is evenly distributed across brokers, all the partitions will be evenly distributed in the live brokers in ISR.
      The fix is:
      kafka-0.8.1.1-src/core/src/main/scala/kafka/controller/PartitionLeaderSelector.scala

      71 71
      case false =>
      72

      • val newLeader = liveBrokersInIsr.head
        72
        + val liveReplicasInIsr = liveAssignedReplicas.filter(r => liveBrokersInIsr.contains(r))
        73
        + val newLeader = liveReplicasInIsr.head

        Attachments

          Activity

            People

            • Assignee:
              jackiewang518 Jianwen Wang
              Reporter:
              jackiewang518 Jianwen Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: