apache / apache/pulsar

[BUG] Judgment criteria for reconnecting the producer

Open
#13,061 2 comments 0 reactions 0 assignees View on GitHub
lifecycle/stale Stale type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

**Describe the bug**
Related to this issue https://github.com/apache/pulsar-client-go/issues/676

https://github.com/apache/pulsar/pull/11804, this PR rewrites the equals method of the Producer, resulting in that when different `pulsar-client-go` uses different port to reconnect, the ` old producer` cannot be removed because the `remoteAddress` will be verified by equals:
``` java
if (producers.remove(producer.getProducerName(), producer)) {
```

https://github.com/apache/pulsar/pull/12846, this pr removes `equals` and will use `hashcode` for judgment. At this time, the
`old producer ` cannot be removed.

The server does not allow different ports to connect to the same producerName. Does it assume that the previous connection will be disconnected first, and the new connection will be established? But the current pulsar-client-go seems to have some problems that the old connection did not handle.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing related issue 676 and pull requests 11804 and 12846, focusing on Producer equality, hashcode, and reconnect behavior. Determine the expected handling when pulsar-client-go reconnects with a different port but the same producerName; done should include a decided criterion that permits the old producer connection to be removed correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.