THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
startReplica(r: Replica) { if(broker_id not in /brokers/topics/[r.topic]/[r.partition]/replicas) throw NotReplicaForPartitionException() if( r's log is not already started) { do local recovery of r's log r.hw = min(last checkpointed HW for r, r.leo) register a leader-change listener on partition r.partition.partition_id } if( a leader does not exist for partition r.partition.partition_id in ZK) leaderElection(r) else { if( //this broker is not the leader, then it is a follower since it is in the AR list for this partition if(this broker is not already the follower of the current leader) becomeFollower(r) } } |
Close replica
...