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的状态。

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐