You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "chenhongSZ (via GitHub)" <gi...@apache.org> on 2024/07/26 16:59:05 UTC

[PR] [fix][client] TransactionCoordinatorClient support retry [pulsar]

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

   ### Motivation
   we have two brokerUrls(one is dead) in PulsarClient serviceUrl, it is working well without enabling transactions.
   `
               # broker test.pulsar.com:6651 is dead
               PulsarClient client = PulsarClient.builder()
                       //.enableTransaction(true)
                       .serviceUrl("pulsar://test.pulsar.com:6650,test.pulsar.com:6651")
                       .build();
   `
   
   If  enabling transactions
   `
               # broker test.pulsar.com:6651 is dead
               PulsarClient client = PulsarClient.builder()
                       .enableTransaction(true)
                       .serviceUrl("pulsar://test.pulsar.com:6650,test.pulsar.com:6651")
                       .build();
   `
   the following error occurs and the `PulsarClient` init fails, It will not retry the other brokerUrl
   
   `
   2024-07-27T00:52:27,787 - ERROR - [pulsar-client-io-1-1:TransactionMetaStoreHandler@120] - Transaction meta handler with transaction coordinator id 14 connection failed.
   org.apache.pulsar.client.api.PulsarClientException: java.util.concurrent.CompletionException: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: test.pulsar.com/127.0.0.1:6651
   	at org.apache.pulsar.client.impl.ConnectionPool.lambda$createConnection$14(ConnectionPool.java:311) ~[classes/:?]
   	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:566) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at java.lang.Thread.run(Thread.java:833) ~[?:?]
   Caused by: java.util.concurrent.CompletionException: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: test.pulsar.com/127.0.0.1:6651
   	at java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:368) ~[?:?]
   	at java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:377) ~[?:?]
   	at java.util.concurrent.CompletableFuture$UniRelay.tryFire(CompletableFuture.java:1097) ~[?:?]
   	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
   	at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162) ~[?:?]
   	at org.apache.pulsar.common.util.netty.ChannelFutures.lambda$toCompletableFuture$0(ChannelFutures.java:58) ~[classes/:?]
   	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:118) ~[netty-common-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:326) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:342) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	... 4 more
   Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: test.pulsar.com/127.0.0.1:6651
   Caused by: java.net.ConnectException: Connection refused
   	at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
   	at sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]
   	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946) ~[?:?]
   	at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:339) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.108.Final.jar:4.1.108.Final]
   	... 4 more
   
   
   `
   
   The root cause is that the `TransactionCoordinatorClient` doesn't support retry.
   
   ### Modifications
   support retry in `TransactionCoordinatorClient`.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


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


Re: [PR] [fix][client] TransactionCoordinatorClient support retry [pulsar]

Posted by "aloyszhang (via GitHub)" <gi...@apache.org>.
aloyszhang merged PR #23081:
URL: https://github.com/apache/pulsar/pull/23081


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


Re: [PR] [fix][client] TransactionCoordinatorClient support retry [pulsar]

Posted by "chenhongSZ (via GitHub)" <gi...@apache.org>.
chenhongSZ commented on PR #23081:
URL: https://github.com/apache/pulsar/pull/23081#issuecomment-2255215856

   > Great work @chenhongSZ! Would it be possible to add a test case?
   
   This pr contains correlation test cases in `TransactionCoordinatorClientTest.java`


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


Re: [PR] [fix][client] TransactionCoordinatorClient support retry [pulsar]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #23081:
URL: https://github.com/apache/pulsar/pull/23081#issuecomment-2256085159

   ## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/23081?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `31.25000%` with `11 lines` in your changes missing coverage. Please review.
   > Project coverage is 73.41%. Comparing base [(`bbc6224`)](https://app.codecov.io/gh/apache/pulsar/commit/bbc62245c5ddba1de4b1e7cee4ab49334bc36277?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`c6b3c47`)](https://app.codecov.io/gh/apache/pulsar/commit/c6b3c4740f64e009b2f90a7e0d5e246375c625a3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 477 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/pulsar/pull/23081/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/pulsar/pull/23081?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #23081      +/-   ##
   ============================================
   - Coverage     73.57%   73.41%   -0.16%     
   - Complexity    32624    33206     +582     
   ============================================
     Files          1877     1917      +40     
     Lines        139502   144077    +4575     
     Branches      15299    15744     +445     
   ============================================
   + Hits         102638   105774    +3136     
   - Misses        28908    30179    +1271     
   - Partials       7956     8124     +168     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pulsar/pull/23081/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [inttests](https://app.codecov.io/gh/apache/pulsar/pull/23081/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `27.44% <25.00%> (+2.86%)` | :arrow_up: |
   | [systests](https://app.codecov.io/gh/apache/pulsar/pull/23081/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.78% <0.00%> (+0.45%)` | :arrow_up: |
   | [unittests](https://app.codecov.io/gh/apache/pulsar/pull/23081/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `72.47% <31.25%> (-0.37%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Files](https://app.codecov.io/gh/apache/pulsar/pull/23081?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [.../transaction/TransactionCoordinatorClientImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/23081?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2Ftransaction%2FTransactionCoordinatorClientImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL3RyYW5zYWN0aW9uL1RyYW5zYWN0aW9uQ29vcmRpbmF0b3JDbGllbnRJbXBsLmphdmE=) | `66.07% <100.00%> (+0.30%)` | :arrow_up: |
   | [...ulsar/client/impl/TransactionMetaStoreHandler.java](https://app.codecov.io/gh/apache/pulsar/pull/23081?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FTransactionMetaStoreHandler.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL1RyYW5zYWN0aW9uTWV0YVN0b3JlSGFuZGxlci5qYXZh) | `67.04% <21.42%> (-0.86%)` | :arrow_down: |
   
   ... and [510 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/23081/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   </details>


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


Re: [PR] [fix][client] TransactionCoordinatorClient support retry [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #23081:
URL: https://github.com/apache/pulsar/pull/23081#issuecomment-2255200463

   Great work @chenhongSZ! Would it be possible to add a test case?


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


Re: [PR] [fix][client] TransactionCoordinatorClient support retry [pulsar]

Posted by "chenhongSZ (via GitHub)" <gi...@apache.org>.
chenhongSZ commented on PR #23081:
URL: https://github.com/apache/pulsar/pull/23081#issuecomment-2256014580

   /pulsarbot run-failure-checks


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