Denovo1998 commented on code in PR #17449:
URL: https://github.com/apache/pulsar/pull/17449#discussion_r1047162934


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java:
##########
@@ -1119,14 +1128,14 @@ public CompletableFuture<MessageId> getLastMessageId() {
     private static final Logger log = 
LoggerFactory.getLogger(NonPersistentTopic.class);
 
     @Override
-    public CompletableFuture<Void> addSchemaIfIdleOrCheckCompatible(SchemaData 
schema) {
+    public CompletableFuture<Void> addSchemaIfIdleOrCheckCompatible(SchemaData 
schema, String subscriptionName) {
         return hasSchema().thenCompose((hasSchema) -> {
             int numActiveConsumers = subscriptions.values().stream()
                     .mapToInt(subscription -> 
subscription.getConsumers().size())
                     .sum();
             if (hasSchema
                     || (!producers.isEmpty())
-                    || (numActiveConsumers != 0)
+                    || (numActiveConsumers != 0 && 
!subscriptionsOnlyIncludedAutoSchema.containsKey(subscriptionName))

Review Comment:
       In addConsumerSchemaTypeForSubscriptions method, 
`subscriptionsOnlyIncludedAutoSchema`  saves only the subscription that 
contains only AUTO Schema Consumers. So we check whether 
subscriptionsOnlyIncludedAutoSchema contains the current 
subscription.subscriptionsOnlyIncludedAutoSchema saves only the subscription 
that contains only AUTO Schema Consumers



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