apache / apache/pulsar

[Bug] Listing non-persistent topics does not work correctly

Open
#21,042 4 comments 0 reactions 1 assignee Claimed by @codelipenghui View on GitHub
deprecated/question Stale
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Version

Pulsar 3.1.0

### Minimal reproduce step

1. Create a persistent and a non-persistent topic
```
./bin/pulsar-admin topics create-partitioned-topic persistent://public/default/persistent-topic -p 3
./bin/pulsar-admin topics create-partitioned-topic non-persistent://public/default/non-persistent-topic -p 3
```
2. List partitioned topics (works as expected)
```
./bin/pulsar-admin topics list-partitioned-topics public/default
non-persistent://public/default/non-persistent-topic
persistent://public/default/persistent-topic
```

### What did you expect to see?

3. List topics (docs state it should include both topic domains)
```
./bin/pulsar-admin topics list public/default
persistent://public/default/persistent-topic-partition-2
persistent://public/default/persistent-topic-partition-0
persistent://public/default/persistent-topic-partition-1
non-persistent://public/default/non-persistent-topic-partition-2
non-persistent://public/default/non-persistent-topic-partition-0
non-persistent://public/default/non-persistent-topic-partition-1
```
4. List topics with topic domain flag set to non-persistent
```
./bin/pulsar-admin topics list public/default -td non_persistent
non-persistent://public/default/non-persistent-topic-partition-2
non-persistent://public/default/non-persistent-topic-partition-0
non-persistent://public/default/non-persistent-topic-partition-1
```

### What did you see instead?

3. List topics (bug: only shows the persistent topics)
```
./bin/pulsar-admin topics list public/default
persistent://public/default/persistent-topic-partition-2
persistent://public/default/persistent-topic-partition-0
persistent://public/default/persistent-topic-partition-1
```
After a while, even the `persistent` topic is missing from `pulsar-admin topics list`

4. List topics with topic domain set to non-persistent (bug: does not find the non-persistent topics)
```
./bin/pulsar-admin topics list public/default -td non_persistent
(nothing)
```

### Anything else?

Retrieving the topic metadata for the non-persistent topic works:
```
./bin/pulsar-admin topics get-partitioned-topic-metadata non-persistent://public/default/on-persistent-topic
{
"partitions" : 3,
"deleted" : false
}
```

### Are you willing to submit a PR?

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.