You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/05/07 23:20:20 UTC
[pulsar] branch master updated: [pulsar-function] fix broken
backward compatibility with v1-namespace while registering function (#4224)
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 3f4c571 [pulsar-function] fix broken backward compatibility with v1-namespace while registering function (#4224)
3f4c571 is described below
commit 3f4c57102f21beeb1dd49dc8f71a06d4e7b45487
Author: Rajan Dhabalia <rd...@apache.org>
AuthorDate: Tue May 7 16:20:15 2019 -0700
[pulsar-function] fix broken backward compatibility with v1-namespace while registering function (#4224)
---
.../pulsar/functions/worker/rest/api/ComponentImpl.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java
index c42acc8..7065a49 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java
@@ -326,10 +326,14 @@ public abstract class ComponentImpl {
final TenantInfo tenantInfo = worker().getBrokerAdmin().tenants().getTenantInfo(tenant);
String qualifiedNamespace = tenant + "/" + namespace;
- if (!worker().getBrokerAdmin().namespaces().getNamespaces(tenant).contains(qualifiedNamespace)) {
- log.error("{}/{}/{} Namespace {} does not exist", tenant, namespace,
- componentName, namespace);
- throw new RestException(Status.BAD_REQUEST, "Namespace does not exist");
+ List<String> namespaces = worker().getBrokerAdmin().namespaces().getNamespaces(tenant);
+ if (namespaces != null && !namespaces.contains(qualifiedNamespace)) {
+ String qualifiedNamespaceWithCluster = String.format("%s/%s/%s", tenant,
+ worker().getWorkerConfig().getPulsarFunctionsCluster(), namespace);
+ if (namespaces != null && !namespaces.contains(qualifiedNamespaceWithCluster)) {
+ log.error("{}/{}/{} Namespace {} does not exist", tenant, namespace, componentName, namespace);
+ throw new RestException(Status.BAD_REQUEST, "Namespace does not exist");
+ }
}
} catch (PulsarAdminException.NotAuthorizedException e) {
log.error("{}/{}/{} Client [{}] is not admin and authorized to operate {} on tenant", tenant, namespace,