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/04/02 09:55:26 UTC

[GitHub] [pulsar] wangjialing218 opened a new pull request #10129: fix the default retry letter and dead letter topic name

wangjialing218 opened a new pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129


   ### Motivation
   
   Fixes #9327
   
   ### Modifications
   
   Correct the default retry letter and dead letter topic name depend on full topic name
   
   


-- 
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] merlimat commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
merlimat commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-812892579


   The problem with this change is that by renaming the default, a user who upgrades the client will suddenly have the DLQ messages routed to a different topic, and this could potentially lead to loose these messages.
   
   


-- 
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] wangjialing218 commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
wangjialing218 commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-818363380


   /pulsarbot run-failure-checks


-- 
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] wangjialing218 commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
wangjialing218 commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-813840744


   Currently, the default name of dead letter topic is {TopicName}-{Subscription}-DLQ while `enableRetry(true)` is not speicified, but when  `enableRetry(true)` is speicified, the default name of dead letter topic is {NamespaceName}-{Subscription}-DLQ, which will be confused.


-- 
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] codelipenghui commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-814125507


   @wangjialing218 We need to handle the compatibility issues when users upgrade to the new Pulsar Client. As @merlimat mentioned, this will lead to data loss when upgrading to the new Pulsar Client.


-- 
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] wangjialing218 commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
wangjialing218 commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-817659376


   /pulsarbot run-failure-checks


-- 
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] wangjialing218 commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
wangjialing218 commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-814539432


   @merlimat @codelipenghui Currently a cosumer with retry message enable could receive another topic's retry message due to the same retry letter topic name.
   Consider a consumer subscribe to a topic with retry topic enable, and another consumer subscribe to another topic under same namespace with same subscription name, both of the two consumers will subscribe to the retry topic {NamespaceName}-{Subscription}-RETRY, and they could receive the retry messages from each other.
   Changing default name of retry letter topic will not cause compatibility issues when users upgrade pulsar client, because consumer will automatic subscribe the retry letter topic. 
   For dead letter topic, since user need to specify the topic name, we need to consider how to handle the compatibility issue. such as only change the default name of retry letter name?


-- 
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 pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
sijie commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-831662610


   @eolivelli please review this PR again


-- 
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] wangjialing218 commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
wangjialing218 commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-816543257


   @codelipenghui @merlimat Add compatible check. If old name of DLQ and retry topic exists, using old topics.


-- 
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] eolivelli commented on a change in pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#discussion_r610487371



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
##########
@@ -121,8 +117,29 @@ public ConsumerBuilderImpl(PulsarClientImpl client, Schema<T> schema) {
         }
         if(conf.isRetryEnable() && conf.getTopicNames().size() > 0 ) {
             TopicName topicFirst = TopicName.get(conf.getTopicNames().iterator().next());
-            String retryLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
-            String deadLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+            String retryLetterTopic = topicFirst + "-" + conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
+            String deadLetterTopic = topicFirst + "-" + conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+
+            //Issue 9327: do compatibility check in case of the default retry and dead letter topic name changed
+            String oldRetryLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
+            String oldDeadLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+            try {
+                PartitionedTopicMetadata partitionedTopicMetadata = client.getLookup().getPartitionedTopicMetadata(TopicName.get(oldRetryLetterTopic)).get();
+                if (partitionedTopicMetadata.partitions > 0) {
+                    retryLetterTopic = oldRetryLetterTopic;
+                }
+            } catch (Exception e) {
+                // oldRetryLetterTopic not exist, do nothing

Review comment:
       can we check for the exact error ?
   otherwise even a network error may fall into this case




-- 
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] codelipenghui merged pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129


   


-- 
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] wangjialing218 commented on a change in pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
wangjialing218 commented on a change in pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#discussion_r611418959



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
##########
@@ -121,8 +117,29 @@ public ConsumerBuilderImpl(PulsarClientImpl client, Schema<T> schema) {
         }
         if(conf.isRetryEnable() && conf.getTopicNames().size() > 0 ) {
             TopicName topicFirst = TopicName.get(conf.getTopicNames().iterator().next());
-            String retryLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
-            String deadLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+            String retryLetterTopic = topicFirst + "-" + conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
+            String deadLetterTopic = topicFirst + "-" + conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+
+            //Issue 9327: do compatibility check in case of the default retry and dead letter topic name changed
+            String oldRetryLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
+            String oldDeadLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+            try {
+                PartitionedTopicMetadata partitionedTopicMetadata = client.getLookup().getPartitionedTopicMetadata(TopicName.get(oldRetryLetterTopic)).get();
+                if (partitionedTopicMetadata.partitions > 0) {
+                    retryLetterTopic = oldRetryLetterTopic;
+                }
+            } catch (Exception e) {
+                // oldRetryLetterTopic not exist, do nothing

Review comment:
       change lookup method so that it could have a retry in case of  retriable error




-- 
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] codelipenghui commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-815383913


   @wangjialing218 This will cause compatible issues because users might topic1 and topic2 as the retry topic name and DLQ name, but after upgrade to the new client version, the client will subscribe to a new retry topic topic3 and the message which need to send to the DLQ will send to a new topic topic4, this is why we need to consider the compatible issue.


-- 
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] wangjialing218 edited a comment on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
wangjialing218 edited a comment on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-814539432


   @merlimat @codelipenghui Currently a cosumer with retry message enable could receive another topic's retry message due to the same retry letter topic name.
   Consider a consumer subscribe to a topic with retry topic enable, and another consumer subscribe to another topic under same namespace with same subscription name, both of the two consumers will subscribe to the retry topic {NamespaceName}-{Subscription}-RETRY, and they could receive the retry messages from each other.
   Changing default name of retry letter topic will not cause compatibility issues when users upgrade pulsar client, because consumer will automatic subscribe the retry letter topic at builder time. 
   For dead letter topic, since user need to specify the topic name, we need to consider how to handle the compatibility issue. such as only change the default name of retry letter name?


-- 
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] eolivelli commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-831709705


   @codelipenghui PTAL


-- 
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] wangjialing218 commented on pull request #10129: fix the default retry letter and dead letter topic name

Posted by GitBox <gi...@apache.org>.
wangjialing218 commented on pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#issuecomment-813851148


   /pulsarbot run-failure-checks


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