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 2018/05/01 00:03:56 UTC

[GitHub] merlimat closed pull request #1695: Remove "global" from returned clusters list

merlimat closed pull request #1695: Remove "global" from returned clusters list
URL: https://github.com/apache/incubator-pulsar/pull/1695
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
index 04389cc98a..be1b7dde12 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
@@ -40,6 +40,7 @@
 import org.apache.pulsar.broker.web.PulsarWebResource;
 import org.apache.pulsar.broker.web.RestException;
 import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.naming.Constants;
 import org.apache.pulsar.common.naming.NamespaceBundle;
 import org.apache.pulsar.common.naming.NamespaceBundleFactory;
 import org.apache.pulsar.common.naming.NamespaceBundles;
@@ -334,7 +335,11 @@ protected ZooKeeperChildrenCache managedLedgerListCache() {
 
     protected Set<String> clusters() {
         try {
-            return pulsar().getConfigurationCache().clustersListCache().get();
+            Set<String> clusters = pulsar().getConfigurationCache().clustersListCache().get();
+
+            // Remove "global" cluster from returned list
+            clusters.remove(Constants.GLOBAL_CLUSTER);
+            return clusters;
         } catch (Exception e) {
             throw new RestException(e);
         }
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java
index 5c9346e22c..73dc79c1b5 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java
@@ -869,4 +869,10 @@ public void brokerNamespaceIsolationPolicies() throws Exception {
         } catch (PulsarAdminException.NotFoundException e) {// expected
         }
     }
+
+    @Test
+    public void clustersList() throws PulsarAdminException {
+        final String cluster = pulsar.getConfiguration().getClusterName();
+        assertEquals(admin.clusters().getClusters(), Lists.newArrayList(cluster));
+    }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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