rdhabalia commented on code in PR #19605:
URL: https://github.com/apache/pulsar/pull/19605#discussion_r1120959144


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1574,13 +1575,19 @@ private void buildProducerAndAddTopic(Topic topic, long 
producerId, String produ
             if (ex.getCause() instanceof 
BrokerServiceException.TopicMigratedException) {
                 Optional<ClusterUrl> clusterURL = 
getMigratedClusterUrl(service.getPulsar());
                 if (clusterURL.isPresent()) {
-                    log.info("[{}] redirect migrated producer to topic {}: 
producerId={}, {}", remoteAddress, topicName,
-                            producerId, ex.getCause().getMessage());
-                    commandSender.sendTopicMigrated(ResourceType.Producer, 
producerId,
-                            clusterURL.get().getBrokerServiceUrl(), 
clusterURL.get().getBrokerServiceUrlTls());
-                    closeProducer(producer);
-                    return null;
-
+                    if (topic.isReplicationBacklogExist()) {
+                        log.info("Topic {} is migrated but replication backlog 
exist: "
+                                        + "producerId = {}, producerName = {}, 
{}", topicName,
+                                producerId, producerName, 
ex.getCause().getMessage());
+                    } else {
+                        log.info("[{}] redirect migrated producer to topic {}: 
"
+                                        + "producerId={}, producerName = {}, 
{}", remoteAddress,
+                                topicName, producerId, producerName, 
ex.getCause().getMessage());
+                        commandSender.sendTopicMigrated(ResourceType.Producer, 
producerId,

Review Comment:
   it's not exactly non-retriable error but client has to retry until topic 
backlog will be drained , after that producers will be redirected to a new 
cluster. it's exactly similar to backlog-quota exceeded error where it's 
non-retriable until backlog is drained. 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to