coderzc opened a new pull request, #25228:
URL: https://github.com/apache/pulsar/pull/25228

   ## Summary
   This PR fixes a bug in topic property update and delete methods where the 
returned `CompletableFuture` is left incomplete when the topic doesn't exist, 
causing callers to hang indefinitely.
   
   ## Problem
   The `internalUpdateNonPartitionedTopicProperties` and 
`internalRemoveNonPartitionedTopicProperties` methods in `PersistentTopicsBase` 
throw `RestException` inside `thenAccept` callbacks. Since exceptions thrown 
inside async callbacks don't propagate to the returned future, callers receive 
a future that never completes.
   
   ## Changes
   - Replace `throw new RestException` with `future.completeExceptionally(new 
WebApplicationException(...))` in both methods
   - Add explicit `return` after exceptional completion to prevent further 
execution
   - Add `.exceptionally()` handler to ensure future completion on any 
unexpected errors
   
   ## Tests
   - Added test case `testTopicPropertiesOnNonExistentTopic` to verify that 
`updateProperties` and `removeProperties` operations on non-existent topics 
correctly return 404 Not Found instead of hanging
   
   ### Changes
   - [x] Fix incomplete futures in topic property update/delete methods
   - [x] Add test for topic property operations on non-existent topic
   
   ### Verifying this change
   Please pick a suitable statement.
   - [ ] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
     - Added test `testTopicPropertiesOnNonExistentTopic` in 
`AdminApi2Test.java`
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (does it add or upgrade a dependency): (no)
   - [ ] The public API: (no)
   - [ ] The schema: (no)
   - [ ] The default values of configurations: (no)
   - [ ] The wire protocol: (no)
   - [ ] The rest endpoints: (no)
   - [ ] The admin cli options: (no)
   - [ ] Anything that affects deployment: (no)
   
   ### Documentation
   
   Check the box below or label this PR directly.
   
   Need to update docs? 
   
   - [x] `doc-not-needed` 
   - [ ] `doc` 
   - [ ] `doc-complete`


-- 
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