This is an automated email from the ASF dual-hosted git repository.

rxl pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 22647cd0cc65aed9c697a4dbb41334efa9030f2a
Author: Aloys <lofterzh...@gmail.com>
AuthorDate: Tue Jul 7 00:42:32 2020 +0800

    fix update partitions error for non-persistent topic (#7459)
    
    
    (cherry picked from commit f8beb7876974cb5c69f74d740926d00fa0cc5a2e)
---
 .../src/main/java/org/apache/pulsar/broker/admin/AdminResource.java    | 3 +--
 .../test/java/org/apache/pulsar/broker/admin/AdminResourceTest.java    | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
index 1d765f5..ecf926c 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
@@ -358,10 +358,9 @@ public abstract class AdminResource extends 
PulsarWebResource {
     }
 
     protected void validatePartitionedTopicMetadata(String tenant, String 
namespace, String encodedTopic) {
-        String completeTopicName = tenant + "/" + namespace + "/" +  
Codec.decode(encodedTopic);
         try {
             PartitionedTopicMetadata partitionedTopicMetadata =
-                    
pulsar().getBrokerService().fetchPartitionedTopicMetadataAsync(TopicName.get(completeTopicName)).get();
+                    
pulsar().getBrokerService().fetchPartitionedTopicMetadataAsync(topicName).get();
             if (partitionedTopicMetadata.partitions < 1) {
                 throw new RestException(Status.CONFLICT, "Topic is not 
partitioned topic");
             }
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminResourceTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminResourceTest.java
index 757b775..509374d 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminResourceTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminResourceTest.java
@@ -98,8 +98,10 @@ public class AdminResourceTest extends BrokerTestBase {
         AdminResource resource = mockResource();
         resource.setPulsar(pulsar);
         // validate should pass when topic is partitioned topic
+        resource.validatePartitionedTopicName(tenant, namespace, 
Codec.encode(partitionedTopic));
         resource.validatePartitionedTopicMetadata(tenant, namespace, 
Codec.encode(partitionedTopic));
         // validate should failed when topic is non-partitioned topic
+        resource.validatePartitionedTopicName(tenant, namespace, 
Codec.encode(nonPartitionedTopic));
         try {
             resource.validatePartitionedTopicMetadata(tenant, namespace, 
Codec.encode(nonPartitionedTopic));
             fail("Should fail validation on non-partitioned topic");

Reply via email to