pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [pulsar] BewareMyPower commented on a change in pull request #9853: Fix schema not added when subscribe an empty topic without schema
Date Wed, 10 Mar 2021 08:01:00 GMT

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



##########
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:
       BTW, for non-persistent topics I'll fix it soon.




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



Mime
View raw message