You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zi...@apache.org on 2026/06/30 04:19:40 UTC

(pulsar) branch master updated: [fix][test] Fix flaky PendingAckInMemoryDeleteTest.txnAckTestBatchAndSharedSubMemoryDeleteTest (#26116)

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

nodece 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 1fc861aaa00 [fix][test] Fix flaky PendingAckInMemoryDeleteTest.txnAckTestBatchAndSharedSubMemoryDeleteTest (#26116)
1fc861aaa00 is described below

commit 1fc861aaa002054fb3410cf20d0e6c5953b9b110
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Tue Jun 30 07:19:33 2026 +0300

    [fix][test] Fix flaky PendingAckInMemoryDeleteTest.txnAckTestBatchAndSharedSubMemoryDeleteTest (#26116)
---
 .../transaction/pendingack/PendingAckInMemoryDeleteTest.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/pendingack/PendingAckInMemoryDeleteTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/pendingack/PendingAckInMemoryDeleteTest.java
index c395c17367b..f3ff5206601 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/pendingack/PendingAckInMemoryDeleteTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/pendingack/PendingAckInMemoryDeleteTest.java
@@ -253,12 +253,18 @@ public class PendingAckInMemoryDeleteTest extends TransactionTestBase {
                             // and it won't clear the last message in cursor batch index ack set
                             consumer.acknowledgeAsync(messageIds[1], commitTwice).get();
                             assertEquals(batchDeletedIndexes.size(), 1);
-                            assertEquals(testPersistentSubscription.getConsumers().get(0).getPendingAcks().size(), 0);
+                            // the consumer pending ack is removed asynchronously on the broker after it processes
+                            // the transactional acknowledgement, so the client side future completing does not
+                            // guarantee the pending ack has been cleared yet; await instead of asserting immediately
+                            Awaitility.await().untilAsserted(() -> assertEquals(
+                                    testPersistentSubscription.getConsumers().get(0).getPendingAcks().size(), 0));
 
                             // the messages has been produced were all acked,
                             // the memory in broker for the messages has been cleared.
                             commitTwice.commit().get();
-                            assertEquals(batchDeletedIndexes.size(), 0);
+                            // the cursor batch deleted indexes are cleared asynchronously on the broker after it
+                            // processes the transaction commit, so await instead of asserting immediately
+                            Awaitility.await().untilAsserted(() -> assertEquals(batchDeletedIndexes.size(), 0));
                             assertEquals(testPersistentSubscription.getConsumers().get(0).getPendingAcks().size(), 0);
                         }
                         count++;