jiangpengcheng opened a new issue, #17982:
URL: https://github.com/apache/pulsar/issues/17982

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Version
   
   db68648c
   
   ### Minimal reproduce step
   
   1. upload package
   
   ```
   ❯ ./bin/pulsar-admin  packages upload 
function://public/default/[email protected] --path 
~/IdeaProjects/pfsql/pfsql-function/target/pfsql-function-0.1.0-SNAPSHOT.jar 
--description "pfsql function"
   ```
   
   2. create function using this package:
   
   ```
   ❯ ./bin/pulsar-admin functions create --name test --output output_topic 
--inputs input_topic --classname 
io.streamnative.pfsql.function.FilterRouteFunction --jar 
function://public/default/[email protected]
   Created successfully
   ```
   
   3. delete the function:
   
   ```
   ❯ ./bin/pulsar-admin   functions delete --name test
   Deleted successfully
   ```
   
   4. recreate the function, and it report 404 error:
   
   ```
   ❯ ./bin/pulsar-admin functions create --name test2 --output output_topic 
--inputs input_topic --classname 
io.streamnative.pfsql.function.FilterRouteFunction --jar 
function://public/default/[email protected]
   
   2022-10-10T14:15:35,623+0800 [AsyncHttpClient-7-1] WARN  
org.apache.pulsar.client.admin.internal.BaseResource - 
[http://localhost:8080/admin/v3/functions/public/default/test2] Failed to 
perform http post request: javax.ws.rs.BadRequestException: HTTP 400 Bad Request
   HTTP 404 Not Found
   
   Reason: HTTP 404 Not Found
   ```
   
   ### What did you expect to see?
   
   function recreated successfully
   
   ### What did you see instead?
   
   function failed to recreate with 404 error
   
   ### Anything else?
   
   the reason is that the builtin "function worker" will delete the related 
package when a function is deleted:
   
   
https://github.com/apache/pulsar/blob/master/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java#L517
   
   I'm not clear about the internal logic, it looks like this is intended 
behavior while I think this is not reasonable.
   
   In my opinion, a package should  be a sharable one for several different 
actions and deleting one action should not affect other or new created actions 
using this package
   
   please correct me if I think it wrong
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to