You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ma...@apache.org on 2023/01/16 08:15:33 UTC

[pulsar] 01/02: Revert "[improve][broker] Follow up #19230 to tighten the validation scope (#19234)"

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

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

commit 3bd4b48f695a8b846eca82e56c63c50f3a86ec4f
Author: mattisonchao <ma...@apache.org>
AuthorDate: Mon Jan 16 16:14:40 2023 +0800

    Revert "[improve][broker] Follow up #19230 to tighten the validation scope (#19234)"
    
    This reverts commit 8f05d2516795f779c8549da7f3b284ebc962098b.
---
 .../pulsar/broker/admin/v2/PersistentTopics.java   |  5 ----
 .../PartitionKeywordCompatibilityTest.java         | 27 ----------------------
 2 files changed, 32 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
index e5e3c6d2712..e6bf99c4118 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
@@ -826,11 +826,6 @@ public class PersistentTopics extends PersistentTopicsBase {
             @QueryParam("deleteSchema") @DefaultValue("false") boolean deleteSchema) {
         try {
             validateTopicName(tenant, namespace, encodedTopic);
-            if (topicName.isPartitioned()) {
-                // There's no way to create the partition topic with `-partition-{index}`, So we can reject it.
-                throw new RestException(Response.Status.PRECONDITION_FAILED,
-                        "Partitioned Topic Name should not contain '-partition-'");
-            }
             internalDeletePartitionedTopic(asyncResponse, authoritative, force, deleteSchema);
         } catch (WebApplicationException wae) {
             asyncResponse.resume(wae);
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PartitionKeywordCompatibilityTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PartitionKeywordCompatibilityTest.java
index fdf2eb29c5e..58b9dcee628 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PartitionKeywordCompatibilityTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PartitionKeywordCompatibilityTest.java
@@ -19,7 +19,6 @@
 package org.apache.pulsar.broker.service.persistent;
 
 
-import static org.testng.Assert.fail;
 import lombok.Cleanup;
 import org.apache.pulsar.broker.service.BrokerTestBase;
 import org.apache.pulsar.client.admin.PulsarAdminException;
@@ -75,30 +74,4 @@ public class PartitionKeywordCompatibilityTest extends BrokerTestBase {
         Assert.assertFalse(topics.contains(topicName));
         Assert.assertFalse(partitionedTopicList.contains(topicName));
     }
-
-    @Test
-    public void testDeletePartitionedTopicValidation() throws PulsarAdminException {
-        final String topicName = "persistent://public/default/testDeletePartitionedTopicValidation";
-        final String partitionKeywordTopic = "persistent://public/default/testDelete-partition-edTopicValidation";
-        final String partitionedTopic = "persistent://public/default/testDeletePartitionedTopicValidation-partition-0";
-        try {
-            admin.topics().deletePartitionedTopic(topicName);
-            fail("expect not found!");
-        } catch (PulsarAdminException.NotFoundException ex) {
-            //ok
-        }
-        try {
-            admin.topics().deletePartitionedTopic(partitionKeywordTopic);
-            fail("expect not found!");
-        } catch (PulsarAdminException.NotFoundException ex) {
-            //ok
-        }
-        try {
-            admin.topics().deletePartitionedTopic(partitionedTopic);
-            fail("expect illegal argument");
-        } catch (PulsarAdminException.PreconditionFailedException ex) {
-            Assert.assertTrue(ex.getMessage().contains("should not contain '-partition-'"));
-            // ok
-        }
-    }
 }