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

yubiao pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 63646567917 [fix][test]Fix flaky test produceCommitTest (#20006)
63646567917 is described below

commit 636465679175b07e260f2c668c8d4e4f4a683487
Author: Xiangying Meng <[email protected]>
AuthorDate: Thu Apr 13 23:09:10 2023 +0800

    [fix][test]Fix flaky test produceCommitTest (#20006)
    
    Fixes https://github.com/apache/pulsar/issues/18466
    ### Motivation
    There are two main goals in solving this issue:
    
    1. Fix the unstable tests in `produceCommitTest`.
    2. Prevent transaction timeouts created by other tests from affecting the 
`testTxnTimeoutAtTransactionMetadataStore` test during its execution.
    
    ### Modification
    1. Change the message-sending method to synchronous. (fix 
`produceCommitTest`)
    2. Increase the transaction timeout to 10 minutes (fix 
`testTxnTimeoutAtTransactionMetadataStore`).
    
    (cherry picked from commit 653271e8d8aeb361ec260780ba88ccf3a880f403)
---
 .../java/org/apache/pulsar/client/impl/TransactionEndToEndTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TransactionEndToEndTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TransactionEndToEndTest.java
index 83feaa3ac11..34cc3bc1ca5 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TransactionEndToEndTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TransactionEndToEndTest.java
@@ -280,9 +280,9 @@ public class TransactionEndToEndTest extends 
TransactionTestBase {
         int messageCnt = 1000;
         for (int i = 0; i < messageCnt; i++) {
             if (i % 5 == 0) {
-                producer.newMessage(txn1).value(("Hello Txn - " + 
i).getBytes(UTF_8)).send();
+                producer.newMessage(txn1).value(("Hello Txn - " + 
i).getBytes(UTF_8)).sendAsync();
             } else {
-                producer.newMessage(txn2).value(("Hello Txn - " + 
i).getBytes(UTF_8)).send();
+                producer.newMessage(txn2).value(("Hello Txn - " + 
i).getBytes(UTF_8)).sendAsync();
             }
             txnMessageCnt++;
         }
@@ -811,7 +811,7 @@ public class TransactionEndToEndTest extends 
TransactionTestBase {
     public Transaction getTxn() throws Exception {
         return pulsarClient
                 .newTransaction()
-                .withTransactionTimeout(10, TimeUnit.SECONDS)
+                .withTransactionTimeout(10, TimeUnit.MINUTES)
                 .build()
                 .get();
     }

Reply via email to