codelipenghui commented on code in PR #19348:
URL: https://github.com/apache/pulsar/pull/19348#discussion_r1090115748
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:
##########
@@ -473,6 +473,11 @@ private CompletableFuture<Long>
individualAckNormal(CommandAck ack, Map<String,
long ackedCount = 0;
long batchSize = getBatchSize(msgId);
Consumer ackOwnerConsumer =
getAckOwnerConsumer(msgId.getLedgerId(), msgId.getEntryId());
+ if (Subscription.isIndividualAckMode(ackOwnerConsumer.subType())
+ &&
!ackOwnerConsumer.getPendingAcks().containsKey(msgId.getLedgerId(),
msgId.getEntryId())) {
+ // this message has been acked, skip to keep stats correct
+ continue;
+ }
Review Comment:
The `ackOwnerConsumer` can be a different consumer.
```java
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.
--
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]