Skip to content

[Broker] Check allowAutoSubscriptionCreation when creating init sub - #14458

Merged
codelipenghui merged 6 commits into
apache:masterfrom
RobertIndie:pip-124-2
Feb 27, 2022
Merged

[Broker] Check allowAutoSubscriptionCreation when creating init sub#14458
codelipenghui merged 6 commits into
apache:masterfrom
RobertIndie:pip-124-2

Conversation

@RobertIndie

@RobertIndie RobertIndie commented Feb 24, 2022

Copy link
Copy Markdown
Member

Master Issue: #13408

Motivation

In #13355, we added support for creating initial subscription when creating the producer. But the broker didn't check if the subscription can be created automatically. The initial subscription will be created even if the allowAutoSubscriptionCreation is disabled.

Modifications

  • Check allowAutoSubscriptionCreation when creating the initial subscription.

Verifying this change

This change is already covered by existing tests, such as testInitialSubscriptionCreationWithAutoCreationDisable.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • doc

Motivation
In apache#13355, we added support for creating initial subscription when creating the producer. But the broker didn't check if the subscription can be created automatically. The initial subscription will be created even if the `allowAutoSubscriptionCreation` is disabled.

Modification
* Check `allowAutoSubscriptionCreation` when creating the initial subscription.

Signed-off-by: Zike Yang <zkyang@streamnative.io>
@github-actions github-actions Bot added the doc-required Your PR changes impact docs and you will update later. label Feb 24, 2022
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java Outdated
@michaeljmarshall

Copy link
Copy Markdown
Member

@codelipenghui - this seems like a missing component for PIP 124, which made it into branch-2.10 already.

Comment thread pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java Outdated
@codelipenghui

Copy link
Copy Markdown
Contributor

I have added release/2.10.1 just to make sure I will not miss to cherry-pick this one, after cherry-picking I will change to 2.10.0,

Signed-off-by: Zike Yang <zkyang@streamnative.io>
Signed-off-by: Zike Yang <zkyang@streamnative.io>
RobertIndie added a commit to RobertIndie/pulsar that referenced this pull request Feb 25, 2022
…t sub

Motivation

This PR is the doc for apache#14458

Modification

* Add doc for check `allowAutoSubscriptionCreation` when creating init sub

Signed-off-by: Zike Yang <zkyang@streamnative.io>
Signed-off-by: Zike Yang <zkyang@streamnative.io>
Signed-off-by: Zike Yang <zkyang@streamnative.io>
@github-actions github-actions Bot added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Feb 25, 2022

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

log.warn("[{}] {} initialSubscriptionName: {}, topic: {}",
remoteAddress, msg, initialSubscriptionName, topicName);
commandSender.sendErrorResponse(requestId,
ServerError.NotAllowedError, msg);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the consequence of sending this NotAllowedError is that the consumer will indefinitely send messages back to the broker to be redelivered. I think this is a sane default since it means messages won't be lost. I just want to make sure we agree on this design.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. +1

Signed-off-by: Zike Yang <zkyang@streamnative.io>

@eolivelli eolivelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@mattisonchao mattisonchao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codelipenghui
codelipenghui merged commit db25438 into apache:master Feb 27, 2022
codelipenghui pushed a commit that referenced this pull request Mar 1, 2022
…#14458)

Master Issue: #13408

### Motivation

In #13355, we added support for creating initial subscription when creating the producer. But the broker didn't check if the subscription can be created automatically. The initial subscription will be created even if the `allowAutoSubscriptionCreation` is disabled.

(cherry picked from commit db25438)
@codelipenghui codelipenghui modified the milestones: 2.11.0, 2.10.0 Mar 1, 2022
@Anonymitaet Anonymitaet added doc-complete Your PR changes impact docs and the related docs have been already added. and removed doc-required Your PR changes impact docs and you will update later. labels Mar 2, 2022
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Apr 20, 2022
…apache#14458)

Master Issue: apache#13408 

### Motivation

In apache#13355, we added support for creating initial subscription when creating the producer. But the broker didn't check if the subscription can be created automatically. The initial subscription will be created even if the `allowAutoSubscriptionCreation` is disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. doc-complete Your PR changes impact docs and the related docs have been already added.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants