Skip to content

Election

Election is a utility with the algorithms for partition leader election.

leaderForOffline

leaderForOffline(
  controllerContext: ControllerContext,
  isLeaderRecoverySupported: Boolean,
  partitionsWithUncleanLeaderRecoveryState: Seq[(TopicPartition, Option[LeaderAndIsr], Boolean)]
): Seq[ElectionResult] // (1)!
leaderForOffline(
  partition: TopicPartition,
  leaderAndIsrOpt: Option[LeaderAndIsr],
  uncleanLeaderElectionEnabled: Boolean,
  isLeaderRecoverySupported: Boolean,
  controllerContext: ControllerContext): ElectionResult
  1. Uses the other leaderForOffline for every tuple in partitionsWithUncleanLeaderRecoveryState

leaderForOffline requests the given ControllerContext for the partition replicas and removes replicas that are not online.

For the input LeaderAndIsr defined, leaderForOffline offlinePartitionLeaderElection (with the replica brokers) and...FIXME


leaderForOffline is used when: