You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/06/19 03:19:56 UTC

[GitHub] [rocketmq] caigy commented on a diff in pull request #4477: implement transaction message escape

caigy commented on code in PR #4477:
URL: https://github.com/apache/rocketmq/pull/4477#discussion_r901040846


##########
broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:
##########
@@ -354,7 +358,13 @@ private PutMessageResult putBackToHalfQueueReturnResult(MessageExt messageExt) {
         PutMessageResult putMessageResult = null;
         try {
             MessageExtBrokerInner msgInner = transactionalMessageBridge.renewHalfMessageInner(messageExt);
-            putMessageResult = transactionalMessageBridge.putMessageReturnResult(msgInner);
+            if (this.transactionalMessageBridge.getBrokerController().isSpecialServiceRunning()
+                    && BrokerRole.SLAVE == this.transactionalMessageBridge.getBrokerController().getMessageStoreConfig()
+                    .getBrokerRole()) {
+                putMessageResult = transactionalMessageBridge.getBrokerController().getEscapeBridge().putMessage(msgInner);
+            } else {
+                putMessageResult = transactionalMessageBridge.putMessageReturnResult(msgInner);
+            }

Review Comment:
   If retry times of the half message reached maximum value, the broker where it escaped would not check it any more, and the broker it was born also had skipped it, that message would be lost.



##########
broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:
##########
@@ -354,7 +358,13 @@ private PutMessageResult putBackToHalfQueueReturnResult(MessageExt messageExt) {
         PutMessageResult putMessageResult = null;
         try {
             MessageExtBrokerInner msgInner = transactionalMessageBridge.renewHalfMessageInner(messageExt);
-            putMessageResult = transactionalMessageBridge.putMessageReturnResult(msgInner);
+            if (this.transactionalMessageBridge.getBrokerController().isSpecialServiceRunning()
+                    && BrokerRole.SLAVE == this.transactionalMessageBridge.getBrokerController().getMessageStoreConfig()
+                    .getBrokerRole()) {
+                putMessageResult = transactionalMessageBridge.getBrokerController().getEscapeBridge().putMessage(msgInner);
+            } else {
+                putMessageResult = transactionalMessageBridge.putMessageReturnResult(msgInner);
+            }

Review Comment:
   If retry times of the half message reached maximum value, the broker where it escaped would not check it any more, and the broker it was born also had skipped it, that message would be lost.



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org