[fix][broker] Ignore the exception of creating namespace - #18837
Conversation
| try { | ||
| broker.getAdminClient().namespaces().createNamespace(ns.toString()); | ||
| } catch (Exception e) { | ||
| log.warn(e.getMessage()); |
There was a problem hiding this comment.
| log.warn(e.getMessage()); | |
| log.warn("...", e); |
Besides, if the default manner to start a standalone cluster falls back to this branch, how can a standalone cluster successfully create the namespace (with what extra configs)?
There was a problem hiding this comment.
When the authentication/authorization is enabled, we should configure the brokerClientAuthenticationPlugin and brokerClientAuthenticationParameters.
To avoid breaking change, so I made this PR.
There was a problem hiding this comment.
The namespace could be created via pulsar-admin with correct authentication info later. See how the C++ client's unit tests set up the test env. https://github.com/apache/pulsar-client-cpp/blob/2018a06e8afcde4de59971cfbc5f653a4f9d7897/build-support/start-test-service-inside-container.sh#L59-L63
|
Cross-reference to #18755. |
BewareMyPower
left a comment
There was a problem hiding this comment.
Could you add an integration test to avoid the regression?
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
60b3f2c to
410ca5f
Compare
Codecov Report
@@ Coverage Diff @@
## master #18837 +/- ##
============================================
- Coverage 46.17% 37.38% -8.80%
+ Complexity 10359 5076 -5283
============================================
Files 703 414 -289
Lines 68845 44670 -24175
Branches 7382 4573 -2809
============================================
- Hits 31788 16699 -15089
+ Misses 33448 25735 -7713
+ Partials 3609 2236 -1373
Flags with carried forward coverage won't be shown. Click here to find out more.
|
### Motivation apache#17864 and apache#18837 tried to fix the regression of the namespace bundle policy in standalone by creating the namespace via `PulsarAdmin`. It brings a problem that the namespace would not be created successfully if the authentication of the built-in admin client was not configured. It brings the regression that makes the set up of the C++ client's unit tests in branch-2.11 fail. Because the steps are: - Start a standalone - Update the policy of `public/default` via `pulsar-admin` without creating the namespace ### Modifications Do not use `PulsarAdmin` to create the namespace when starting the standalone. Instead, set the bundle policy according to the `defaultNumberOfNamespaceBundles` config. Add a `testStandaloneWithRocksDB` to test the namespace can still be created even if no broker client authentication is configured. Then move the bundle policy test from `SmokeTest` to this test.
### Motivation apache#15186 changed the behavior of how to create the default namespace. However, it brings a regression that even if the built-in admin didn't have the authentication configured while the standalone enabled the authentication, the namespace could still be created successfully. This PR also changed the deploy script to remove the creation of "public/default" namespace. Instead, it grants the permission to this namespace directly. After apache#17864 and apache#18837, the namespace will be created by the built-in admin again. But the deploy script would fail. ### Modifications Create the default namespace via `pulsar-admin` in the deploy script.
Motivation
In the standalone model, when the
adminclient hasn't permission to create the namespace, the Pulsar will exit.We should keep the same logic with branch-2.10.
https://github.com/apache/pulsar/blob/branch-2.10/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java#L409-L414
Modifications
Add
try...catchto pack.Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: