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


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -2021,6 +2022,16 @@ public CompletableFuture<Void> connectionOpened(final 
ClientCnx cnx) {
                 return null;
             }
 
+            if (cause instanceof 
PulsarClientException.IncompatibleSchemaException
+                    && schema instanceof AutoProduceBytesSchema 
autoProduceBytesSchema
+                    && !autoProduceBytesSchema.hasUserProvidedSchema()) {
+                client.reloadSchemaForAutoProduceProducer(topic, 
autoProduceBytesSchema)
+                    .whenComplete((__, throwable) -> {
+                        future.completeExceptionally(cause);
+                    });
+                return null;
+            }

Review Comment:
   > Will this impact the producer with auto produce schema created by user? 
   
   It does not matter.
   - The schema AutoProduceBytesSchema was only used for registering the 
producer.
   - The producer created by the user will register schemas when publishing 
messages, see also 
https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java#L2521-L2523
   
   >  As I understand only replicator can refresh the schema, but user will 
specify the schema. Will it cause infinite loop with 
IncompatibleSchemaException?
   
   Since the producer with `AUTO_PRODUCE` schema will use the schema that was 
got from the server-side, it will not get the error 
`IncompatibleSchemaException` 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