-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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-broker] Implement AutoSubscriptionCreation by namespace override #6637
Conversation
@murong00 thanks for this feature. Please check the CI failures. |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
globalZk().setData(path(POLICIES, namespaceName.toString()), | ||
jsonMapper().writeValueAsBytes(policiesNode.getKey()), policiesNode.getValue().getVersion()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to call setData()
asynchronously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
globalZk().setData(path(POLICIES, namespaceName.toString()), | ||
jsonMapper().writeValueAsBytes(policiesNode.getKey()), policiesNode.getValue().getVersion()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the above comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@codelipenghui I hava addressed your comment, please help to take a look, thanks. |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
log.info("[{}] Successfully removed autoTopicCreation override on namespace {}", clientAppId(), namespaceName); | ||
asyncResponse.resume(Response.noContent().build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The response should complete in the zookeeper callback. Otherwise, the broker always returns success.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codelipenghui Thanks for pointing out this, have fixed.
jsonMapper().writeValueAsBytes(policiesNode.getKey()), policiesNode.getValue().getVersion(), | ||
(rc, path1, ctx, stat) -> { | ||
if (rc == KeeperException.Code.OK.intValue()) { | ||
policiesCache().invalidate(path(POLICIES, namespaceName.toString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks should complete the asyncResponse
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
String autoOverride = autoTopicCreationOverride.allowAutoTopicCreation ? "enabled" : "disabled"; | ||
log.info("[{}] Successfully {} autoTopicCreation on namespace {}", clientAppId(), autoOverride, namespaceName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should move to the zookeeper callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
String autoOverride = autoSubscriptionCreationOverride.allowAutoSubscriptionCreation ? "enabled" : "disabled"; | ||
log.info("[{}] Successfully {} autoSubscriptionCreation on namespace {}", clientAppId(), autoOverride, namespaceName); | ||
asyncResponse.resume(Response.noContent().build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should move to the zookeeper callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
log.info("[{}] Successfully removed autoSubscriptionCreation override on namespace {}", clientAppId(), namespaceName); | ||
asyncResponse.resume(Response.noContent().build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should move to the zookeeper callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
@murong00 Could you please rebase your branch since some test-related fixes merged into the master branch. |
/pulsarbot run-failure-checks |
Docs have been added: https://pulsar.apache.org/docs/en/next/pulsar-admin/#set-auto-topic-creation |
…ide (apache#6637) ### Motivation Add a new namespace policy `autoSubscriptionCreationOverride` which will enable an override of broker `autoSubscriptionCreation` settings on the namespace level. Users can keep `autoSubscriptionCreation` disabled for the broker and allow it on a specific namespace using this feature. ### Modifications * Add a new namespace policy: `autoSubscriptionCreationOverride` and associated API / CLI interface for setting and removing. * When checking `autoSubscriptionCreation` configuration, the broker first retrieves namespace policies from zookeeper. If not set, it falls back to broker configuration. * Some minor improvement on `autoTopicCreationOverride` (e.g. v1 Namespaces API & cli md)
Motivation
Add a new namespace policy
autoSubscriptionCreationOverride
which will enable an override of brokerautoSubscriptionCreation
settings on the namespace level. Users can keepautoSubscriptionCreation
disabled for the broker and allow it on a specific namespace using this feature.Modifications
autoSubscriptionCreationOverride
and associated API / CLI interface for setting and removing.autoSubscriptionCreation
configuration, the broker first retrieves namespace policies from zookeeper. If not set, it falls back to broker configuration.autoTopicCreationOverride
(e.g. v1 Namespaces API & cli md)