apache / apache/pulsar

[Bug] [Non-persistent topic] Pulsar broker delete the whole subscription after trigger delete only one consumer from that subscription for the non-persistent topic

Open
#23,993 0 comments 0 reactions 0 assignees View on GitHub
type/bug
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.

### Read release policy

- [x] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

### Version

apachepulsar/pulsar-all:3.0.2
apachepulsar/pulsar-all:3.0.9

java pulsar client app 3.2.2 run in k8s

### Minimal reproduce step

- start app with 1 replicas in k8s, cover this logic:

1. create non-persistent topic or use allowAutoTopicCreation: "true" and allowAutoTopicCreationType: "non-partitioned"
2. create subscription Shared type
3. create consumer in the sub

- scale app to 2 replicas => there 2 consumer create:
```
# pulsarctl $TLS_OPTS topics stats non-persistent://public/Test/TestRequest
"subscriptions": {
"TestRequest": {
....
"type": "Shared",
"consumers": [
{
"availablePermits": 1000,
"unackedMessages": 0,
"msgRateOut": 0,
"msgThroughputOut": 0,
"msgRateRedeliver": 0,
"consumerName": "8420b7f1",
"metadata": {}
},
{
"availablePermits": 1000,
"unackedMessages": 0,
"msgRateOut": 0,
"msgThroughputOut": 0,
"msgRateRedeliver": 0,
"consumerName": "dd825dce",
"metadata": {}
}
]
}
```

- scale down app to 1 replicas => from broker logs, the scale down replicas consumer is removed from subscription
- then do recheck the broker non-persistent topic see that the subscription is gone as soon as the replica is scale down:
```
# pulsarctl $TLS_OPTS topics stats non-persistent://public/Test/TestRequest
"subscriptions": {},
```

### What did you expect to see?

I expected
- the subscription still there
- only one of the consumer in the subscription is removed from the non-persistent topic as 1 replicas from app is scale down

### What did you see instead?

I see:
- the subscription from the non-persistent topic is gone
- so the left up running replicas falling into fail state when the sub and consumer is gone

### Anything else?

_No response_

### Are you willing to submit a PR?

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

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named. Reproduce with Pulsar 3.0.2 or 3.0.9, the Java client, and a Kubernetes scale-down while inspecting broker logs and non-persistent topic stats; done means the subscription remains and only the removed consumer disappears.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kubernetes
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.