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


##########
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`, the 
subscriptionsOnlyIncludedAutoSchema saves only the subscription that contains 
only AUTO schema consumers. So we should check whether 
subscriptionsOnlyIncludedAutoSchema contains the current subscription and 
numActiveConsumers. If subscriptionsOnlyIncludedAutoSchema save all 
subscription and its corresponding all schematype consumer, then we can check 
the no schema consumer count. But I think it's a waste.



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