pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] saandrews commented on a change in pull request #903: PIP-8: Introduce peer cluster for global namespace redirection
Date Thu, 01 Jan 1970 00:00:00 GMT
saandrews commented on a change in pull request #903: PIP-8: Introduce peer cluster for global
namespace redirection
URL: https://github.com/apache/incubator-pulsar/pull/903#discussion_r151822063

 File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
 @@ -501,91 +509,127 @@ protected void validateDestinationOwnership(DestinationName fqdn,
boolean author
-    protected void validateReplicationSettingsOnNamespace(String property, String cluster,
String namespace) {
-        NamespaceName namespaceName = new NamespaceName(property, cluster, namespace);
-        validateReplicationSettingsOnNamespace(pulsar(), namespaceName);
-    }
      * If the namespace is global, validate the following - 1. If replicated clusters are
configured for this global
      * namespace 2. If local cluster belonging to this namespace is replicated 3. If replication
is enabled for this
-     * namespace
+     * namespace <br/>
+     * It validates if local cluster is part of replication-cluster. If local cluster is
not part of the replication
+     * cluster then it redirects request to peer-cluster if any of the peer-cluster is part
of replication-cluster of
+     * this namespace. If none of the cluster is part of the replication cluster then it
fails the validation.
-     * @param pulsarService
      * @param namespace
      * @throws Exception
-    protected static void validateReplicationSettingsOnNamespace(PulsarService pulsarService,
NamespaceName namespace) {
+    protected void validateGlobalNamespaceOwnership(NamespaceName namespace) {
         try {
-            validateReplicationSettingsOnNamespaceAsync(pulsarService, namespace).get(cacheTimeOutInSec,
+            ClusterData peerClusterData = checkLocalOrGetPeerReplicationCluster(pulsar(),
+                    .get(cacheTimeOutInSec, SECONDS);
+            // if peer-cluster-data is present it means namespace is owned by that peer-cluster
and request should be
+            // redirect to the peer-cluster
+            if (peerClusterData != null) {
+                URI redirect = getRedirectionUrl(peerClusterData);
 Review comment:
   To avoid cyclic request between clusters due to misconfiguration or other issues, should
the request indicate that it's a redirected request?

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:

With regards,
Apache Git Services

View raw message