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/12/11 02:38:43 UTC

[GitHub] [pulsar] liangyepianzhou commented on a change in pull request #13135: [Transaction]No TransactionCoordinatorNotFound, but automatic reconnect

liangyepianzhou commented on a change in pull request #13135:
URL: https://github.com/apache/pulsar/pull/13135#discussion_r767078065



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java
##########
@@ -294,7 +340,27 @@ public void handleAddSubscriptionToTxnResponse(CommandAddSubscriptionToTxnRespon
         } else {
             LOG.error("Add subscription to txn failed for request {} error {}.",
                     response.getRequestId(), response.getError());
-            handleTransactionFailOp(response.getError(), response.getMessage(), op);
+            if (handleTransactionFailOp(response.getError(), response.getMessage(), op)) {
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Get a response for request {} error TransactionCoordinatorNotFound and try it again",
+                            response.getRequestId());
+                }
+                timer.newTimeout(timeout -> {
+                    long requestId = client.newRequestId();
+                    TxnID txnID = op.txnID;
+                    List<Subscription> subscriptionList = op.subscriptionList;
+                    ByteBuf cmd = Commands.newAddSubscriptionToTxn(
+                            requestId, txnID.getLeastSigBits(), txnID.getMostSigBits(), subscriptionList);
+                    OpForAddSubscriptionToTxnCallBack opNew = OpForAddSubscriptionToTxnCallBack
+                            .create(cmd, op.callback, txnID, subscriptionList,
+                                    op.backoff);
+                    onNewRequest(op, opNew, requestId);
+                }, op.backoff.next(), TimeUnit.MILLISECONDS);
+                return;
+            }
+            LOG.error("Add subscription to txn failed for request {} error {}.",

Review comment:
       This contains the name of the operation




-- 
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: commits-unsubscribe@pulsar.apache.org

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