Kafka rebalancing is designed to redistribute all the partitions of topic to subscriber group alive members so that any of the topic partitions is used by only one consumer at any given moment. So in case if consumers have just subscribed to a topic, everything is clear, but consumer api also provides a way to assign a specific partition to a consumer:
void assign(Collection<TopicPartition> partitions)
Now lets assume we have:
- a topic with 5 partitions: 1,2,3,4,5
- a consumer group with 3 members: 1,2,3
- members 1 and 2 has just subscribed to a topic, member 3 has assigned partition 1 to itself
So how the rebalancing will work in such case ? Will the partition 1 always be assigned to member 3(while it is alive) resulting that other members can read only from other partitions(2,3,4,5) ? Can group coordinator assign also another partitions to member 3 ? What happens to partition 1 in case when member 3 goes down and later comes back ?
Thanks in advance