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 2020/05/06 06:59:36 UTC

[GitHub] [pulsar] trexinc opened a new issue #6887: ttlDurationDefaultInSeconds is not applied

trexinc opened a new issue #6887:
URL: https://github.com/apache/pulsar/issues/6887


   Pulsar 2.5.0
   broker.conf has ttlDurationDefaultInSeconds=3600
   But when creating a new namespace it is still created with ttl 0.


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



[GitHub] [pulsar] trexinc commented on issue #6887: ttlDurationDefaultInSeconds is not applied

Posted by GitBox <gi...@apache.org>.
trexinc commented on issue #6887:
URL: https://github.com/apache/pulsar/issues/6887#issuecomment-625918708


   Or maybe just the documentation should be updated?
   


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



[GitHub] [pulsar] sijie commented on issue #6887: ttlDurationDefaultInSeconds is not applied

Posted by GitBox <gi...@apache.org>.
sijie commented on issue #6887:
URL: https://github.com/apache/pulsar/issues/6887#issuecomment-624978548


   > But when creating a new namespace it is still created with ttl 0.
   
   Where did you check the TTL value?


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



[GitHub] [pulsar] alexku7 commented on issue #6887: ttlDurationDefaultInSeconds is not applied

Posted by GitBox <gi...@apache.org>.
alexku7 commented on issue #6887:
URL: https://github.com/apache/pulsar/issues/6887#issuecomment-625205116


   Hi
   Here are the steps for reproduce the issue:
   1. Check that the default value is configured in the broker's config:
   
   root@pulsar-bastion-5db9984cf8-w8stw:/pulsar/bin# ./pulsar-admin brokers get-runtime-config | grep ttlDurationDefaultInSeconds
     "ttlDurationDefaultInSeconds" : "3600",
   
   2. create a new namescpace:
   
   root@pulsar-bastion-5db9984cf8-w8stw:/pulsar/bin# ./pulsar-admin namespaces create internal/test44
   
   3. check the policy on the new created namespace:
   
   root@pulsar-bastion-5db9984cf8-w8stw:/pulsar/bin# ./pulsar-admin namespaces get-message-ttl internal/test44
   0
   The output shows the value of zero, e.g. endless ttl  but should be 3600
   
   


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



[GitHub] [pulsar] trexinc commented on issue #6887: ttlDurationDefaultInSeconds is not applied

Posted by GitBox <gi...@apache.org>.
trexinc commented on issue #6887:
URL: https://github.com/apache/pulsar/issues/6887#issuecomment-625688794


   I am interested if you can give some pointers.


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



[GitHub] [pulsar] trexinc commented on issue #6887: ttlDurationDefaultInSeconds is not applied

Posted by GitBox <gi...@apache.org>.
trexinc commented on issue #6887:
URL: https://github.com/apache/pulsar/issues/6887#issuecomment-625905506


   @sijie @Omega-Ariston - there is actually the following code in the broker. So it seems that it does take the default TTL into consideration at the actual expiry check. So the bug is kind of more 
    cosmetic than anything else.
   Do you think that maybe get-namespace-ttl API should return the effective TTL?
   
       @Override
       public void checkMessageExpiry() {
           TopicName name = TopicName.get(topic);
           Policies policies;
           try {
               policies = brokerService.pulsar().getConfigurationCache().policiesCache()
                       .get(AdminResource.path(POLICIES, name.getNamespace()))
                       .orElseThrow(() -> new KeeperException.NoNodeException());
               int defaultTTL = brokerService.pulsar().getConfiguration().getTtlDurationDefaultInSeconds();
               int message_ttl_in_seconds = (policies.message_ttl_in_seconds <= 0 && defaultTTL > 0) ? defaultTTL
                       : policies.message_ttl_in_seconds;
               if (message_ttl_in_seconds != 0) {
                   subscriptions.forEach((subName, sub) -> sub.expireMessages(message_ttl_in_seconds));
                   replicators.forEach((region, replicator) -> ((PersistentReplicator)replicator).expireMessages(message_ttl_in_seconds));
               }
           } catch (Exception e) {
               if (log.isDebugEnabled()) {
                   log.debug("[{}] Error getting policies", topic);
               }
           }
       }
   


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



[GitHub] [pulsar] trexinc commented on issue #6887: ttlDurationDefaultInSeconds is not applied

Posted by GitBox <gi...@apache.org>.
trexinc commented on issue #6887:
URL: https://github.com/apache/pulsar/issues/6887#issuecomment-625922543


   As I see it - it is actually a nice feature. You can changes the global default TTL and it immediately applies to all namespaces with default 0 TTL.


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



[GitHub] [pulsar] sijie commented on issue #6887: ttlDurationDefaultInSeconds is not applied

Posted by GitBox <gi...@apache.org>.
sijie commented on issue #6887:
URL: https://github.com/apache/pulsar/issues/6887#issuecomment-625585715


   @alexku7 Currently the admin restful api returns the value stored in namespace policies directly. It doesn't take the value from broker configuration. It should be simple to add a fix. Are you interested in contributing a fix for that?


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