You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/06/09 03:55:25 UTC

[pulsar] branch master updated: [fix][txn] fix NPE of TransactionMetaStoreHandler (#15840)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new f9b0912dc3b [fix][txn] fix NPE of TransactionMetaStoreHandler (#15840)
f9b0912dc3b is described below

commit f9b0912dc3b7768c604b3f1c039c4068bb0d5810
Author: congbo <39...@users.noreply.github.com>
AuthorDate: Thu Jun 9 11:55:18 2022 +0800

    [fix][txn] fix NPE of TransactionMetaStoreHandler (#15840)
---
 .../apache/pulsar/client/impl/TransactionMetaStoreHandler.java    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java
index d14faa227cb..2b65b38f51f 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java
@@ -131,9 +131,6 @@ public class TransactionMetaStoreHandler extends HandlerState
                 return;
             }
 
-            connectionHandler.setClientCnx(cnx);
-            cnx.registerTransactionMetaStoreHandler(transactionCoordinatorId, this);
-
             // if broker protocol version < 19, don't send TcClientConnectRequest to broker.
             if (cnx.getRemoteEndpointProtocolVersion() > ProtocolVersion.v18.getValue()) {
                 long requestId = client.newRequestId();
@@ -147,6 +144,8 @@ public class TransactionMetaStoreHandler extends HandlerState
                             cnx.channel().close();
                         }
 
+                        connectionHandler.setClientCnx(cnx);
+                        cnx.registerTransactionMetaStoreHandler(transactionCoordinatorId, this);
                         if (!this.connectFuture.isDone()) {
                             this.connectFuture.complete(null);
                         }
@@ -170,6 +169,9 @@ public class TransactionMetaStoreHandler extends HandlerState
             } else {
                 if (!changeToReadyState()) {
                     cnx.channel().close();
+                } else {
+                    connectionHandler.setClientCnx(cnx);
+                    cnx.registerTransactionMetaStoreHandler(transactionCoordinatorId, this);
                 }
                 this.connectFuture.complete(null);
             }