mattisonchao commented on code in PR #19171:
URL: https://github.com/apache/pulsar/pull/19171#discussion_r1065694295


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PersistentTopicTest.java:
##########
@@ -422,4 +422,24 @@ public void testCreateNonExistentPartitions() throws 
PulsarAdminException, Pulsa
         }
         
Assert.assertEquals(admin.topics().getPartitionedTopicMetadata(topicName).partitions,
 4);
     }
+
+    @Test
+    public void testCompatibilityWithPartitionKeyword() throws 
PulsarAdminException, PulsarClientException {
+        final String topicName = 
"persistent://prop/ns-abc/testCompatibilityWithPartitionKeyword";
+        TopicName topicNameEntity = TopicName.get(topicName);
+        String partition2 = topicNameEntity.getPartition(2).toString();
+        Producer<byte[]> producer = pulsarClient.newProducer()
+                .topic(partition2)
+                .create();
+        List<String> topics = admin.topics().getList("prop/ns-abc");
+        producer.close();
+        conf.setAllowAutoTopicCreation(false);
+        Assert.assertTrue(topics.contains(partition2));
+        Assert.assertThrows(PulsarAdminException.NotFoundException.class,
+                () -> admin.topics().getPartitionedTopicMetadata(topicName));
+        producer = pulsarClient.newProducer()

Review Comment:
   Because I set `conf.setAllowAutoTopicCreation(false);`, consider this case:
   
   1. Enable `allowAutoTopicCreation`.
   2. Use a producer to create the topic 
"persistent://prop/ns-abc/testCompatibilityWithPartitionKeyword-2" 
   3. For some reason, upgrade to the new broker version and disable 
`allowAutoTopicCreation `
   4. the producer can not reconnect anymore.



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