The topic and partition whose leader needs to be elected
The current leader and isr of input partition read from zookeeper
The leader and isr request, with the newly selected leader and isr, and the set of replicas to receive the LeaderAndIsrRequest.
NoReplicaOnlineException
If no replica in the assigned replicas list is alive
Select the new leader, new isr and receiving replicas (for the LeaderAndIsrRequest): 1. If at least one broker from the isr is alive, it picks a broker from the live isr as the new leader and the live isr as the new isr. 2. Else, if unclean leader election for the topic is disabled, it throws a NoReplicaOnlineException. 3. Else, it picks some alive broker from the assigned replica list as the new leader and the new isr. 4. If no broker in the assigned replica list is alive, it throws a NoReplicaOnlineException Replicas to receive LeaderAndIsr request = live assigned replicas Once the leader is successfully registered in zookeeper, it updates the allLeaders cache