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/05 05:26:43 UTC
[GitHub] sijie closed pull request #1735: Simplify creation of functions
namespace
sijie closed pull request #1735: Simplify creation of functions namespace
URL: https://github.com/apache/incubator-pulsar/pull/1735
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-functions/worker/src/main/java/org/apache/pulsar/functions/worker/Worker.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/Worker.java
index a7fd982a47..469cdf033a 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/Worker.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/Worker.java
@@ -24,6 +24,7 @@
import org.apache.pulsar.client.admin.PulsarAdmin;
import org.apache.pulsar.client.admin.PulsarAdminException;
import org.apache.pulsar.common.conf.InternalConfigurationData;
+import org.apache.pulsar.common.policies.data.Policies;
import org.apache.pulsar.common.policies.data.RetentionPolicies;
import org.apache.pulsar.functions.worker.rest.WorkerServer;
@@ -101,7 +102,10 @@ private static URI initialize(WorkerConfig workerConfig)
if (e.getStatusCode() == Response.Status.NOT_FOUND.getStatusCode()) {
// if not found than create
try {
- admin.namespaces().createNamespace(workerConfig.getPulsarFunctionsNamespace());
+ Policies policies = new Policies();
+ policies.retention_policies = new RetentionPolicies(-1, -1);
+ admin.namespaces().createNamespace(workerConfig.getPulsarFunctionsNamespace(),
+ policies);
} catch (PulsarAdminException e1) {
// prevent race condition with other workers starting up
if (e1.getStatusCode() != Response.Status.CONFLICT.getStatusCode()) {
@@ -110,14 +114,6 @@ private static URI initialize(WorkerConfig workerConfig)
throw e1;
}
}
- try {
- admin.namespaces().setRetention(
- workerConfig.getPulsarFunctionsNamespace(),
- new RetentionPolicies(Integer.MAX_VALUE, Integer.MAX_VALUE));
- } catch (PulsarAdminException e1) {
- log.error("Failed to set retention policy for pulsar functions namespace", e);
- throw new RuntimeException(e1);
- }
} else {
log.error("Failed to get retention policy for pulsar function namespace {}",
workerConfig.getPulsarFunctionsNamespace(), e);
----------------------------------------------------------------
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