You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by rf...@apache.org on 2022/11/09 03:00:41 UTC

[pulsar] branch master updated: [fix][fn] Do not delete managed package when delete function (#18030)

This is an automated email from the ASF dual-hosted git repository.

rfu 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 ef5346bb79a [fix][fn] Do not delete managed package when delete function (#18030)
ef5346bb79a is described below

commit ef5346bb79a0fbb871b9d9c6c9493a88228c6d2b
Author: jiangpengcheng <sc...@gmail.com>
AuthorDate: Wed Nov 9 11:00:33 2022 +0800

    [fix][fn] Do not delete managed package when delete function (#18030)
---
 .../functions/worker/rest/api/ComponentImpl.java   | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 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 a42874a42f0..0b6c2bbd61f 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
@@ -524,21 +524,13 @@ public abstract class ComponentImpl implements Component<PulsarWorkerService> {
                                             String functionPackagePath) {
         if (!functionPackagePath.startsWith(Utils.HTTP)
                 && !functionPackagePath.startsWith(Utils.FILE)
-                && !functionPackagePath.startsWith(Utils.BUILTIN)) {
-            if (worker().getWorkerConfig().isFunctionsWorkerEnablePackageManagement()) {
-                try {
-                    worker().getBrokerAdmin().packages().delete(functionPackagePath);
-                } catch (PulsarAdminException e) {
-                    log.error("{}/{}/{} Failed to cleanup package in package management with url {}", tenant,
-                            namespace, componentName, functionPackagePath, e);
-                }
-            } else {
-                try {
-                    WorkerUtils.deleteFromBookkeeper(worker().getDlogNamespace(), functionPackagePath);
-                } catch (IOException e) {
-                    log.error("{}/{}/{} Failed to cleanup package in BK with path {}", tenant, namespace, componentName,
-                            functionPackagePath, e);
-                }
+                && !functionPackagePath.startsWith(Utils.BUILTIN)
+                && !worker().getWorkerConfig().isFunctionsWorkerEnablePackageManagement()) {
+            try {
+                WorkerUtils.deleteFromBookkeeper(worker().getDlogNamespace(), functionPackagePath);
+            } catch (IOException e) {
+                log.error("{}/{}/{} Failed to cleanup package in BK with path {}", tenant, namespace, componentName,
+                        functionPackagePath, e);
             }
 
         }