poorbarcode commented on code in PR #22206:
URL: https://github.com/apache/pulsar/pull/22206#discussion_r1595294179


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -607,6 +609,32 @@ protected void 
handlePartitionMetadataRequest(CommandPartitionedTopicMetadata pa
             isTopicOperationAllowed(topicName, TopicOperation.LOOKUP, 
authenticationData, originalAuthData).thenApply(
                     isAuthorized -> {
                 if (isAuthorized) {
+                    // Get if exists, respond not found error if not exists.
+                    if (!partitionMetadata.isMetadataAutoCreationEnabled()) {
+                        final NamespaceResources namespaceResources = 
getBrokerService().pulsar().getPulsarResources()
+                                .getNamespaceResources();
+                        final TopicResources topicResources = 
getBrokerService().pulsar().getPulsarResources()
+                                .getTopicResources();
+                        return 
namespaceResources.getPartitionedTopicResources()
+                            .getPartitionedTopicMetadataAsync(topicName, false)
+                            .thenAccept(metadata -> {
+                                if (metadata.isPresent()) {
+                                    
commandSender.sendPartitionMetadataResponse(metadata.get().partitions, 
requestId);
+                                    return;
+                                }
+                                if (topicName.isPersistent()) {
+                                    
topicResources.persistentTopicExists(topicName).thenAccept(exists -> {
+                                        if (exists) {

Review Comment:
   Have caught the exception, Thanks for reminding me



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