Skip to content

[fix] [client] call redeliver 1 msg but did 2 msgs - #23943

Merged
poorbarcode merged 2 commits into
apache:masterfrom
poorbarcode:fix/redeliver
Feb 10, 2025
Merged

poorbarcode merged 2 commits into
apache:masterfrom
poorbarcode:fix/redeliver

Conversation

@poorbarcode

@poorbarcode poorbarcode commented Feb 7, 2025 •

Copy link
Copy Markdown
Contributor

Motivation

Issue: call redeliver 1 message, but it will redeliver 2 messages, you can reproduce the issue by the new test testBatchMessageNAck

Modifications

fix the bug

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: x

@poorbarcode poorbarcode added this to the 4.1.0 milestone Feb 7, 2025
@poorbarcode poorbarcode self-assigned this Feb 7, 2025
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Feb 7, 2025
@Technoboy- Technoboy- added ready-to-test and removed doc-not-needed Your PR changes do not impact docs labels Feb 7, 2025
@Technoboy- Technoboy- closed this Feb 7, 2025
@Technoboy- Technoboy- reopened this Feb 7, 2025
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Feb 7, 2025
@codecov-commenter

codecov-commenter commented Feb 8, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.25%. Comparing base (bbc6224) to head (bfa194c).
⚠️ Report is 1301 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23943      +/-   ##
============================================
+ Coverage     73.57%   74.25%   +0.68%     
+ Complexity    32624     2375   -30249     
============================================
  Files          1877     1853      -24     
  Lines        139502   143735    +4233     
  Branches      15299    16334    +1035     
============================================
+ Hits         102638   106730    +4092     
+ Misses        28908    28596     -312     
- Partials       7956     8409     +453     
Flag Coverage Δ
inttests 26.71% <9.09%> (+2.13%) ⬆️
systests 23.21% <9.09%> (-1.12%) ⬇️
unittests 73.76% <100.00%> (+0.91%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...va/org/apache/pulsar/client/impl/ConsumerImpl.java 79.44% <100.00%> (+1.87%) ⬆️
...n/util/collections/GrowableArrayBlockingQueue.java 97.00% <100.00%> (+1.56%) ⬆️

... and 1036 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@poorbarcode
poorbarcode merged commit 7a79c78 into apache:master Feb 10, 2025
BewareMyPower pushed a commit that referenced this pull request Feb 10, 2025
poorbarcode added a commit that referenced this pull request Feb 11, 2025
poorbarcode added a commit that referenced this pull request Feb 11, 2025
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Feb 11, 2025
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
@nodece

nodece commented Feb 12, 2025

Copy link
Copy Markdown
Member

@poorbarcode Could you fix the build error on the branch-3.0?

import static com.google.common.base.Preconditions.checkState;

This import is not used.

@poorbarcode

Copy link
Copy Markdown
Contributor Author

@nodece

Could you fix the build error on the branch-3.0?

import static com.google.common.base.Preconditions.checkState;

This import is not used.

@lhotari has fixed, Thanks

@DataProvider
public Object[][] enabledBatchSend() {
return new Object[][] {
{false},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it's false, even without this change, testBatchMessageNAck could still pass

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it only affects bacthed messages


// Negative ack and verify result/
Message<byte[]> receive1 = consumer.receive();
consumer.pause();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's meaningless here. pause() should only affect the message listener

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Java client, pause() will pause sending new permits, so it's not specific to message listener.

protected void increaseAvailablePermits(ClientCnx currentCnx, int delta) {
int available = AVAILABLE_PERMITS_UPDATER.addAndGet(this, delta);
while (available >= getCurrentReceiverQueueSize() / 2 && !paused) {
if (AVAILABLE_PERMITS_UPDATER.compareAndSet(this, available, 0)) {
if (log.isDebugEnabled()) {
log.debug("[{}] Sending permit-cmd to broker with available permits = {}", topic, available);
}
sendFlowPermitsToBroker(currentCnx, available);
break;
} else {
available = AVAILABLE_PERMITS_UPDATER.get(this);
}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pause is for stop receiving msgs from broker

nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Feb 19, 2025
(cherry picked from commit 7a79c78)
(cherry picked from commit f6166c7)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Feb 20, 2025
(cherry picked from commit 7a79c78)
(cherry picked from commit 7d86d18)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Feb 24, 2025
(cherry picked from commit 7a79c78)
(cherry picked from commit f6166c7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants