This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.11 by this push:
new 7f2dfec204c [fix][fn] Do not delete managed package when delete
function (#18030)
7f2dfec204c is described below
commit 7f2dfec204c4b0a7d5058b47005134ca7943c912
Author: jiangpengcheng <[email protected]>
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 | 23 +++++++---------------
1 file changed, 7 insertions(+), 16 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 f628ebbb7f9..239e1d7b0fd 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
@@ -504,22 +504,13 @@ public abstract class ComponentImpl implements
Component<PulsarWorkerService> {
String functionPackagePath =
functionMetaData.getPackageLocation().getPackagePath();
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
managemanet with url {}", tenant,
- namespace, componentName,
functionMetaData.getPackageLocation().getPackagePath(), e);
- }
- } else {
- try {
-
WorkerUtils.deleteFromBookkeeper(worker().getDlogNamespace(),
-
functionMetaData.getPackageLocation().getPackagePath());
- } catch (IOException e) {
- log.error("{}/{}/{} Failed to cleanup package in BK with
path {}", tenant, namespace, componentName,
-
functionMetaData.getPackageLocation().getPackagePath(), 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);
}
}