apache Kafka中partition的leader为-1情况分析

来源:互联网 发布:软件测试行业怎么样 编辑:程序博客网 时间:2024/06/05 17:25

1.broker shutdown的时候,partition的leader在此broker上,controller选主没有成功,移除此broker后,对应的partition的leader就被赋值成-1了。

2.给此broker发送stopReplicaRequest

调用controller.removeReplicaFromIsr,从zk读取当前partition的状态,从isr中移除此broker,并更新zk信息(如果leader为此broker,则新leader被置为-1,代表没有leader,为什么没有选择isr中其他broker为leader?)

发送leaderAndIsrRequest到此partition的leader,发送updateMetaRequest给所有broker

更新ReplicaStateMachine中replicaState的状态。

0 0
原创粉丝点击