shibd opened a new pull request, #23884: URL: https://github.com/apache/pulsar/pull/23884
### Motivation When transaction component init fails, it will try to close the topic, but maybe not remove topic from cache. | time | thread `createTransactionBufferSystemTopicClient` | thread `create topic` | | --- | --- | --- | | 1 | | topic ledger open complete and [new PersistentTopic object](https://github.com/apache/pulsar/blob/b02d52ca8c8afd62681c0e243d16d8958abb5380/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L1800-L1802)| | 2 | | new TransactionBuffer | | 3 | | Try get [AbortedTxnProcessor](https://github.com/apache/pulsar/blob/9ebd97941d8ebe074423349d03307683e7fa3de2/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SingleSnapshotAbortedTxnProcessorImpl.java#L56-L60) | | 4 | [`Failed to create snapshot writer` and close topic](https://github.com/apache/pulsar/blob/9ebd97941d8ebe074423349d03307683e7fa3de2/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SingleSnapshotAbortedTxnProcessorImpl.java#L56-L60) | | | 5 | set topic fenced and closing | | | 6 | try remove topic from broker cache, [since the topic feature is not done, will ignore it](https://github.com/apache/pulsar/blob/b02d52ca8c8afd62681c0e243d16d8958abb5380/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L2427-L2430) | | | 7 | | Topic future success complete | ### Modifications - Make `topic.close` run after topicFuture complete ### Verifying this change - You can run `testNoOrphanClosedTopicIfTxnInternalFailed` to reproduce this. ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc` <!-- Your PR contains doc changes. --> - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later --> - [x] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `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]
