[fix][broker] fix incorrect unack stats when dup ack a message#19348
[fix][broker] fix incorrect unack stats when dup ack a message#19348labuladong wants to merge 2 commits intoapache:masterfrom
Conversation
| if (Subscription.isIndividualAckMode(ackOwnerConsumer.subType()) | ||
| && !ackOwnerConsumer.getPendingAcks().containsKey(msgId.getLedgerId(), msgId.getEntryId())) { | ||
| // this message has been acked, skip to keep stats correct | ||
| continue; | ||
| } |
There was a problem hiding this comment.
The ackOwnerConsumer can be a different consumer.
private Consumer getAckOwnerConsumer(long ledgerId, long entryId) {
Consumer ackOwnerConsumer = this;
if (Subscription.isIndividualAckMode(subType)) {
if (!getPendingAcks().containsKey(ledgerId, entryId)) {
for (Consumer consumer : subscription.getConsumers()) {
if (consumer != this && consumer.getPendingAcks().containsKey(ledgerId, entryId)) {
ackOwnerConsumer = consumer;
break;
}
}
}
}
return ackOwnerConsumer;
}We will still have the issue that the unacked messages count is decreased for this consumer, but actually the owner consumer is another consumer.
There was a problem hiding this comment.
I don't understand, if the actual consumer is another consumer, addAndGetUnAckedMsgs can update the unack count of that consumer:
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java
Lines 1049 to 1060 in 96fb7da
|
The pr had no activity for 30 days, mark with Stale label. |
|
Since we will start the RC version of
So drag this PR to |
|
The pr had no activity for 30 days, mark with Stale label. |
Fixes #19268
Modifications
For shared-type consumers, if can't find the message position in pendingAck set, skip the following process.
Verifying this change
Does this pull request potentially affect one of the following parts:
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: labuladong#20