PulsarAdmin maybe create nonPartitionTopic and partitionedTopic for same topic.
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
**Describe the bug**
In PersistentTopics, there are two methods `createNonPartitionedTopic` and `createPartitionedTopic`.
There is race condition, maybe create nonpartitioned and partitioned managed-ledgers.
**To Reproduce**
**broker**
I modify some code to help to reproduce problem. see commit: https://github.com/horizonzy/pulsar/commit/991bf82f218567cea5c3511b7a807b55652c596e
**client**
```
PulsarAdminBuilder pulsarAdminBuilder = new PulsarAdminBuilderImpl().serviceHttpUrl("http://localhost:8080");
PulsarAdmin admin = pulsarAdminBuilder.build();
admin.topics().createNonPartitionedTopicAsync("horizon-topic");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
admin.topics().createPartitionedTopicAsync("horizon-topic", 4);
```
**Expected behavior**
Maybe we need check ownership before operation to avoid distributed lock, and introduce jvm lock to avoid it.
**Picture**
Contributor guide
Assessment
This issue has not been assessed yet.