[fix][broker] Correct the 'connected' status in topic stats of multi-partition topic for geo replication
Motivation
The default value of the connected field in org.apache.pulsar.common.policies.data.stats.ReplicatorStatsImpl is false, and the logic for accumulating each partition (org.apache.pulsar.common.policies.data.stats.ReplicatorStatsImpl#add) is this.connected &= stats.connected;. This causes the status of a multi-partition topic to always be false after calculation, and it is impossible to truly feedback the correct status of the geo replication task.
Modifications
Modify the connected field in org.apache.pulsar.common.policies.data.stats.ReplicatorStatsImpl from false to true.
Documentation
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
Good catch! the connected is always false after the connection is reconnected/disconnected.
Could you check https://github.com/apache/pulsar/blob/v4.0.1/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/stats/TopicStatsImpl.java#L335-L343? This seems to be the root cause.