poorbarcode opened a new pull request, #16248: URL: https://github.com/apache/pulsar/pull/16248
### Motivation E.g. `client.lookup(by producer)`, `topic.unload`, `consumer.subscribe` executed at the same time: | Time | `client.lookup(by producer)` | `topic.unload` | `consumer.subscribe` | | ----------- | ----------- | ----------- | ----------- | | 1 | | | `ServerCnx.consumers.putIfAbsent(consumerId, consumerFuture)` | | 2 | get existing persistent topic | | | | 3 | create a new persistent subscription | | | | 4 | create a new pending ack handle | | | | 5 | repaly async | | | | 6 | | | waiting for pending ack log repaly finish | | 6 | | topic.close | | | 7 | | async close subscription | | | 8 | | change pending ack handle state --> `close` | | | 9 | change pending ack handle state `init` --> `ready` | | | | 10 | change state failure | | | | 11 | | | subscribe timeout | | 12 | | | retry subscribe | | 13 | | | get exists `consumerFuture` in `ServerCnx.consumers` | | 14 | | | waiting for pending ack log repaly finish | | 15 | | | subscribe timeout | | 16 | | | ...... (loop step12 ~ step15) | Step 6/14: `PersistentSubscription.addConsumer` will waiting for pending ack replay done. https://github.com/apache/pulsar/blob/ebcc47ee7ceb43f680640ad72e51a06d9856458d/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java#L205-L206 Step 10: When failure to modify the pending-ack-handle-state will not terminate the `pendingAckHandleFuture` https://github.com/apache/pulsar/blob/ebcc47ee7ceb43f680640ad72e51a06d9856458d/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack/impl/MLPendingAckReplyCallBack.java#L46-L61 After step 11: Cmd-Subscribe will not succeed even after 100 retries. ### Modifications When failure to modify the pending-ack-handle-state, make `pendingAckHandleFuture` exceptionally complete. ### Documentation Check the box below or label this PR directly. Need to update docs? - [ ] `doc-required` (Your PR needs to update docs, and you will update later) - [x] `doc-not-needed` (Please explain why) - [ ] `doc` (Your PR contains doc changes) - [ ] `doc-complete` (Docs have been already added) -- 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]
