codelipenghui commented on code in PR #20888:
URL: https://github.com/apache/pulsar/pull/20888#discussion_r1275715909


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/OneWayReplicatorTest.java:
##########
@@ -75,4 +79,29 @@ public void testReplicatorProducerStatInTopic() throws 
Exception {
             admin2.topics().delete(topicName);
         });
     }
+
+    @Test
+    public void testCreateRemoteConsumerFirst() throws Exception {
+        final String topicName = BrokerTestUtil.newUniqueName("persistent://" 
+ defaultNamespace + "/tp_");
+        Producer<String> producer1 = 
client1.newProducer(Schema.STRING).topic(topicName).create();
+        // Wait for replicator started.
+        Awaitility.await().untilAsserted(() -> {
+            Optional<Topic> topicOptional2 = 
pulsar2.getBrokerService().getTopic(topicName, false).get();
+            assertTrue(topicOptional2.isPresent());
+            PersistentTopic persistentTopic2 = (PersistentTopic) 
topicOptional2.get();
+            assertTrue(!persistentTopic2.getProducers().isEmpty());

Review Comment:
   ```suggestion
               assertFalse(persistentTopic2.getProducers().isEmpty());
   ```



##########
pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java:
##########
@@ -1290,6 +1290,33 @@ private void testIncompatibleSchema() throws Exception {
         assertThrows(SchemaSerializationException.class, message2::getValue);
     }
 
+    /**
+     * This test just ensure that schema check still keeps the original logic: 
if there has any producer, but no schema
+     * was registered, the new consumer could not register new schema.
+     * TODO: I think this design should be improved: if a producer used 
"AUTO_PRODUCE_BYTES" schema, we should allow
+     *       the new consumer to register new schema. But before we can solve 
this problem, we need to modify
+     *       "CmdProducer" to let the Broker know that the Producer uses a 
schema of type "AUTO_PRODUCE_BYTES".

Review Comment:
   Yes, I agree. It should be the right solution. Please help create an issue 
to track the following fix.



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