congbobo184 opened a new pull request, #15840:
URL: https://github.com/apache/pulsar/pull/15840

   ### Motivation
   fix transactionMetadataStoreHandle cnx is null.
   
   
https://github.com/apache/pulsar/blob/b13d15c4d6d795f33c6ed23f920fabbb3eeaf745/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java#L134-L154
   
   because
   
https://github.com/apache/pulsar/blob/b13d15c4d6d795f33c6ed23f920fabbb3eeaf745/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java#L142
   is the async method, set cnx, and change to ready state is not an atomic 
operation.
   1. set cnx into this handle
   2. reconnect will set the cnx to null 
https://github.com/apache/pulsar/blob/29308e48b78a01959ee8067dbcac67d0e903e8a4/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java#L101
   3. then send connect request and get a response that will change state to 
ready state.
   4. the client will not reconnect because the state is ready
   5. the cnx also is null. transactionMetadataStoreHandle will not do txn op.
   ### Modifications
   fix race condition
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
     - Does this pull requestintroducese a new feature? (yes)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs 
/ not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create afollow-upp 
issue for adding the documentation
   


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