You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/02/08 17:46:47 UTC
[GitHub] [pulsar] massakam opened a new pull request #6275: [broker] Fix bug
that tenants whose allowed clusters include global cannot be created/updated
massakam opened a new pull request #6275: [broker] Fix bug that tenants whose allowed clusters include global cannot be created/updated
URL: https://github.com/apache/pulsar/pull/6275
### Motivation
If the allowed clusters include `global`, tenant creation and update will fail with the following error:
```sh
$ pulsar-admin tenants create -r xxx.xxx.xxx -c global,dev1,dev2 sample-tenant
Clusters do not exist
Reason: Clusters do not exist
```
However, there is actually the `global` cluster in ZK.
```sh
[zk: localhost:2184(CONNECTED) 14] ls /admin/clusters
[dev1, dev2, global]
```
As a result of the investigation, I found that `global` was removed from the cluster list in the configuration store cache after getting the list of clusters by the REST API. This is due to the following:
https://github.com/apache/pulsar/blob/e1357a7d1ae6a51dfa742986a4a2afe33beb0256/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/ClustersBase.java#L87-L91
`global` is removed from the `clusters` variable, which seems to be not a deep copy but a shallow copy.
### Modifications
When getting the list of clusters from the configuration store and deleting `global` from it, create a new `Set` instance using stream API.
```java
Set<String> clusters = clustersListCache().get().stream()
.filter(cluster -> !Constants.GLOBAL_CLUSTER.equals(cluster)).collect(Collectors.toSet());
```
In addition, allow `global` to be included in allowed clusters when creating and updating tenants, even if the `global` cluster does not exist in the list of clusters stored in ZK. Even if the `global` cluster is not registered in ZK, global topics will work fine.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] merlimat merged pull request #6275: [broker] Fix bug that
tenants whose allowed clusters include global cannot be created/updated
Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #6275: [broker] Fix bug that tenants whose allowed clusters include global cannot be created/updated
URL: https://github.com/apache/pulsar/pull/6275
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services