oneby-wang commented on code in PR #25208:
URL: https://github.com/apache/pulsar/pull/25208#discussion_r2769500825


##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/AcknowledgementsGroupingTrackerTest.java:
##########
@@ -405,6 +407,54 @@ public void testDoIndividualBatchAckAsync() {
         tracker.close();
     }
 
+    @Test
+    public void testDoIndividualBatchAckNeverAffectIsDuplicate() throws 
Exception {
+        ConsumerConfigurationData<?> conf = new ConsumerConfigurationData<>();
+        conf.setMaxAcknowledgmentGroupSize(1);
+        PersistentAcknowledgmentsGroupingTracker tracker =
+                new PersistentAcknowledgmentsGroupingTracker(consumer, conf, 
eventLoopGroup);
+
+        BatchMessageIdImpl batchMessageId0 = new BatchMessageIdImpl(5, 1, 0, 
0, 10, null);
+        BatchMessageIdImpl batchMessageId1 = new BatchMessageIdImpl(5, 1, 0, 
1, 10, null);
+
+        int loops = 10000;
+        int addAcknowledgmentThreadCount = 10;
+        List<Thread> addAcknowledgmentThreads = new 
ArrayList<>(addAcknowledgmentThreadCount);
+        for (int i = 0; i < addAcknowledgmentThreadCount; i++) {
+            Thread addAcknowledgmentThread = new Thread(() -> {
+                for (int j = 0; j < loops; j++) {
+                    tracker.addAcknowledgment(batchMessageId0, 
AckType.Individual, Collections.emptyMap());
+                }
+            }, "doIndividualBatchAck-thread-" + i);
+            addAcknowledgmentThread.start();
+            addAcknowledgmentThreads.add(addAcknowledgmentThread);
+        }
+
+        int isDuplicateThreadCount = 10;
+        AtomicBoolean assertResult = new AtomicBoolean();
+        List<Thread> isDuplicateThreads = new 
ArrayList<>(isDuplicateThreadCount);
+        for (int i = 0; i < isDuplicateThreadCount; i++) {
+            Thread isDuplicateThread = new Thread(() -> {
+                for (int j = 0; j < loops; j++) {
+                    boolean duplicate = tracker.isDuplicate(batchMessageId1);
+                    assertResult.set(assertResult.get() || duplicate);

Review Comment:
   PR submitted: https://github.com/apache/pulsar/pull/25217.



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