Hi everyone, I am trying to understand the failover subscription logic a bit more in detail. Specifically, the doc <https://pulsar.apache.org/docs/3.0.x/concepts-messaging/#failover>mention this part for partitioned topic:
* If the number of partitions in a partitioned topic is less than the number of consumers:For example, in the diagram below, this partitioned topic has 2 partitions and there are 4 consumers.Each partition has 1 active consumer and 1 stand-by consumer.* - *For p0, consumer A is the master consumer, while consumer B would be the next consumer in line to receive messages if consumer A is disconnected.* - *For p1, consumer C is the master consumer, while consumer D would be the next consumer in line to receive messages if consumer C is disconnected* . So, as per this, since all four (A,B,C,D) consumers make connection to both partitions p0 and p1, the consumers array size in AbstractDispatcherSingleActiveConsumer should be 4. Now based on the consumer index choosing logic spanning lines 126 - 130 <https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java#L126-L130> , the consumer index assigned to p0 should be 0 (i.e. A) and to p1 should be 1 (i.e. B) . I am assuming here that all 4 consumers have the same priority.Now consider consumer B getting disconnected. remaining consumer array == (A,C,D) . In this case, p1 will get a new consumer using logic 1 % 3 = 1 index i.e. consumer C now. p0's consumer would remain same i.e. 0 % 3 = 0 i.e. A. Now next consider that consumer A also goes down. remaining consumer array == (C,D) In this case, p0 will get a new consumer -> 0%2 = 0 i.e. consumer C and p1 would now be shifted to 1%2 = 1 Consumer D . Even though p1's active consumer was untouched, p1 got a consumer shift.So I have couple of questions - - Am I missing something? Is my understanding of logic correct? - If yes, why does the doc say what it says? And why change p1's consumer uselessly in above example Regards -- Girish Sharma