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

Pulsar is creating a unlimited number topics with name _transaction_pending_ack-__pending_ack_state__transaction_pending_ack #12727

Closed
eolivelli opened this issue Nov 10, 2021 · 10 comments · Fixed by #12749
Assignees
Labels
type/bug The PR fixed a bug or issue reported a bug

Comments

@eolivelli
Copy link
Contributor

eolivelli commented Nov 10, 2021

Describe the bug

In my application I see that Pulsar is creating many topics, appending "_transaction_pending_ack-__pending_ack_state__transaction_pending_ack" to the previous topic name.
I see this "topic name"

persistent://public/default/MY_TOPIC-8975a6f5-be96-4c03-b5b9-02ad570dd1f9__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack-__pending_ack_state__transaction_pending_ack

Each topic has one subscription '__pending_ack_state'

To Reproduce
Create a Consumer with Transactions and EnableAckReceipt, use it

Expected behavior
Only at topic should be created

** Context
Pulsar version 2.8.1

@eolivelli eolivelli added type/bug The PR fixed a bug or issue reported a bug release/blocker Indicate the PR or issue that should block the release until it gets resolved labels Nov 10, 2021
@eolivelli
Copy link
Contributor Author

@congbobo184 @codelipenghui FYI

@eolivelli
Copy link
Contributor Author

basically you start with persistent://public/default/MY_TOPIC
then Pulsar creates a new system topic persistent://public/default/MY_TOPIC__transaction_pending_ack (this happens for every topic when you enable the Transaction Coordinator)

then Pulsar creates a new topic persistent://public/default/MY_TOPIC__transaction_pending_ack-__pending_ack_state
this event triggers the creation of persistent://public/default/MY_TOPIC__transaction_pending_ack-__pending_ack_state__transaction_pending_ack

and so on...

@eolivelli
Copy link
Contributor Author

I believe that the problem is because for each topic we create a new topic with this suffix __transaction_pending_ack
and one subscription named __pending_ack_state
but for each subscription we create a new topic named TOPIC_NAME + subscriptionName + __transaction_pending_ack
so TOPIC_NAME + __pending_ack_state + __transaction_pending_ack

then again TOPIC_NAME becomes TOPIC_NAME + __pending_ack_state + __transaction_pending_ack and the process proceeds

See here:

.getTransactionPendingAckStoreSuffix(originPersistentTopic.getName(), subscription.getName());

@codelipenghui
Copy link
Contributor

@congbobo184 Could you please check this issue?

@eolivelli
Copy link
Contributor Author

it looks like it is a regression in 2.8.1, I didn't see that behaviour in 2.8.0

eolivelli added a commit to datastax/pulsar-jms that referenced this issue Nov 10, 2021
@eolivelli
Copy link
Contributor Author

I have found a "workaround", basically the thing that triggers this problem is a tool that I have that lists all the topics and for each topic calls getSubscriptions:

List<String> allTopics = pulsarAdmin.topics().getList(systemNamespace);
for (String topic : allTopics) {
         
          log.info("Scanning topic {}", topic);
          List<String> subscriptions = pulsarAdmin.topics().getSubscriptions(topic);
}

if you run this loop many times you will see this problem.

so my understanding is that getSubscriptions is creating those system topics even for system subscriptions

@congbobo184
Copy link
Contributor

this is a bug, I will fix it.

eolivelli added a commit to datastax/pulsar-jms that referenced this issue Nov 10, 2021
congbobo184 added a commit that referenced this issue Nov 13, 2021
fix #12727
### Motivation
Now transaction system topic can be created.

### Modifications
we should not allow broker or user create by transaction system format topic.

1. checkout topic auto create.
2. admin create topic.

### Verifying this change

add some test for it
@eaba
Copy link

eaba commented Nov 13, 2021

@eolivelli thanks for capturing this issue. In my case such topics were in thousands and this affected Pattern Consumer. I actually thought it was error from my end but now this issue has been opened and closed, I am relieved.

@eolivelli
Copy link
Contributor Author

@eaba are you using transactions in productions?

If so please take care of testing the upgrade from 2.8 to 2.9.
There are a few changes in the wire protocol for transactions.
Please report any issue

@eaba
Copy link

eaba commented Nov 14, 2021

@eolivelli thanks for the heads up.

eolivelli pushed a commit that referenced this issue Nov 15, 2021
fix #12727
Now transaction system topic can be created.

we should not allow broker or user create by transaction system format topic.

1. checkout topic auto create.
2. admin create topic.

add some test for it

(cherry picked from commit 2c4d913)
eaba added a commit to Sharp-Pulsar/SharpPulsar that referenced this issue Nov 16, 2021
eolivelli pushed a commit to eolivelli/pulsar that referenced this issue Nov 29, 2021
)

fix apache#12727
### Motivation
Now transaction system topic can be created.

### Modifications
we should not allow broker or user create by transaction system format topic.

1. checkout topic auto create.
2. admin create topic.

### Verifying this change

add some test for it
eolivelli pushed a commit that referenced this issue Dec 15, 2021
fix #12727
### Motivation
Now transaction system topic can be created.

### Modifications
we should not allow broker or user create by transaction system format topic.

1. checkout topic auto create.
2. admin create topic.

### Verifying this change

add some test for it

(cherry picked from commit 2c4d913)
sijie pushed a commit to streamnative/pulsar-jms that referenced this issue Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants