This is an automated email from the ASF dual-hosted git repository.
lhotari 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 eb7a4f36da3 [fix][test] fix flaky testNegativeAcksWithBackoff when
batch enabled. (#23986)
eb7a4f36da3 is described below
commit eb7a4f36da3711b9b93527d0bfe26acad1d64b1d
Author: Wenzhi Feng <[email protected]>
AuthorDate: Fri Feb 14 19:18:06 2025 +0800
[fix][test] fix flaky testNegativeAcksWithBackoff when batch enabled.
(#23986)
---
.../java/org/apache/pulsar/client/impl/NegativeAcksTest.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java
index 7ab3e545e98..182c952eac8 100644
---
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java
+++
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java
@@ -256,9 +256,16 @@ public class NegativeAcksTest extends ProducerConsumerBase
{
long firstReceivedAt = System.currentTimeMillis();
long expectedTotalRedeliveryDelay = 0;
for (int i = 0; i < redeliverCount; i++) {
+ Message<String> msg = null;
for (int j = 0; j < N; j++) {
- Message<String> msg = consumer.receive();
+ msg = consumer.receive();
log.info("Received message {}", msg.getValue());
+ if (!batching) {
+ consumer.negativeAcknowledge(msg);
+ }
+ }
+ if (batching) {
+ // for batching, we only need to nack one message in the batch
to trigger redelivery
consumer.negativeAcknowledge(msg);
}
expectedTotalRedeliveryDelay += backoff.next(i);