You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/03/10 07:51:36 UTC

[GitHub] [pulsar] BewareMyPower commented on a change in pull request #9853: Fix schema not added when subscribe an empty topic without schema

BewareMyPower commented on a change in pull request #9853:
URL: https://github.com/apache/pulsar/pull/9853#discussion_r591170704



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -2510,8 +2510,13 @@ private int getMessageTTL() throws Exception {
     public CompletableFuture<Void> addSchemaIfIdleOrCheckCompatible(SchemaData schema) {
         return hasSchema()
             .thenCompose((hasSchema) -> {
-                if (hasSchema || isActive(InactiveTopicDeleteMode.delete_when_no_subscriptions)
-                        || ledger.getTotalSize() != 0) {
+                int numActiveConsumers = subscriptions.values().stream()
+                        .map(subscription -> subscription.getConsumers().size())
+                        .reduce(0, Integer::sum);

Review comment:
       If you mean the `numActiveConsumers`, yes.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org