pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[Bug] Can create both partitioned and non-partitioned topics with the same name.

Open poorbarcode opened this issue 1 year ago • 2 comments

Search before asking

  • [X] I searched in the issues and found nothing similar.

Version

3.0.2

Minimal reproduce step

Broker.conf

  • allowAutoTopicCreation: true
  • allowAutoTopicCreationType: partitioned
  • defaultNumPartitions:1

The latest version of the Go client

  • Create a consumer and subscribe public/default/tp1
    • Broker will create a partitioned topic public/default/tp1 with 1 partition at the step
  • Create a reader and subscribe public/default/tp1
    • Broker will create a non-partitioned topic public/default/tp1

Two bugs:

  • the reader of the Go client should get topic metadata first, then try to subscribe to the partitioned topic. The actual behavior is it subscribes to the public/default/tp1 as a non-partitioned topic. This bug will be fixed in https://github.com/apache/pulsar-client-go
  • **(Highlight)**The Go client should get a not-found error when the reader tries to subscribe to public/default/tp1 as a non-partitioned topic. This bug is the current issue point.

What did you expect to see?

What did you see instead?

Anything else?

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

poorbarcode avatar Feb 06 '24 09:02 poorbarcode

@RobertIndie Thanks for fix this bug ❤️

poorbarcode avatar Feb 06 '24 09:02 poorbarcode

We have faced the same issue in Pulsar 3.1.3 and Java Client 3.2.1. There was a race condition, consumers/producers were created during setting on a namespace level:

    allowAutoTopicCreation: true
    allowAutoTopicCreationType: partitioned
    defaultNumPartitions:6

Screenshot 2024-04-05 at 17 19 59

michalcukierman avatar Apr 05 '24 15:04 michalcukierman