trexinc commented on pull request #6920: URL: https://github.com/apache/pulsar/pull/6920#issuecomment-625905818
@codelipenghui @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: us...@infra.apache.org