Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][client] Fix DLQ producer name conflicts when there are same name consumers #23577

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

geniusjoe
Copy link
Contributor

Main Issue: apache/pulsar-client-go#1297
Relative #21890

Motivation

When multiple consumers with same name are using dlq policies at the same time, prompt will throw below exceptions:
ERRO[0069] Failed to create DLQ producer dlq-topic="persistent://<tenant>/<namespace>/<topic>-<subscription>-DLQ" error="server error: ProducerBusy: org.apache.pulsar.broker.service.BrokerServiceException$NamingException: Producer with name '-<subscription>-<consumerName>-DLQ' is already connected to topic"

Modifications

I think maybe we need to add a random suffix in dlq producer name like: opt.Name = fmt.Sprintf("%s-%s-%s-%s-DLQ", r.topicName, r.subscriptionName, r.consumerName, generateRandomName())

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as DeadLetterTopicTest.testDeadLetterTopicWithProducerName

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

After change golang, java and c++ sdks, we could update document like this pr https://github.com/apache/pulsar-site/pull/772/files.

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions bot added the doc-required Your PR changes impact docs and you will update later. label Nov 7, 2024
@hanmz
Copy link
Contributor

hanmz commented Nov 11, 2024

Can you add a test to verify this case that the consumer name is specified?

@geniusjoe geniusjoe force-pushed the dev/update-dlq-name branch 3 times, most recently from 8b0d001 to 7009d19 Compare November 11, 2024 12:15
@geniusjoe
Copy link
Contributor Author

Can you add a test to verify this case that the consumer name is specified?

@hanmz
I added a new test case testMultipleSameNameConsumersToDeadLetterTopic to test same name consumers situation. Please review again.

@Jason918 Jason918 merged commit c6561e1 into apache:master Nov 25, 2024
56 of 57 checks passed
@lhotari lhotari added this to the 4.1.0 milestone Nov 25, 2024
@lhotari
Copy link
Member

lhotari commented Nov 29, 2024

This doesn't apply to 3.0.x since it doesn't include #21589

lhotari pushed a commit that referenced this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants