pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[fix][broker] Correct the 'connected' status in topic stats of multi-partition topic for geo replication

Open Coselding opened this issue 1 year ago • 1 comments

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

Coselding avatar Dec 09 '24 07:12 Coselding

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.

nodece avatar Dec 11 '24 14:12 nodece