codelipenghui commented on a change in pull request #4265:
[transaction][acknowledge] Introduce in-memory PENDING_ACK state in
acknowledgement path
URL: https://github.com/apache/pulsar/pull/4265#discussion_r293312451
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java
##########
@@ -232,6 +276,29 @@ public void acknowledgeMessage(List<Position> positions,
AckType ackType, Map<St
if (log.isDebugEnabled()) {
log.debug("[{}][{}] Individual acks on {}", topicName,
subName, positions);
}
+ // Check if message is acknowledged by ongoing transaction.
+ if ((pendingAckMessages != null && pendingAckMessages.size() != 0)
|| pendingCumulativeAckMessage != null) {
+ synchronized (PersistentSubscription.this) {
+ positions.forEach(position -> {
+ checkArgument(position instanceof PositionImpl);
+ // If single ack try to ack message in pending_ack
status, fail the ack.
+ if (pendingAckMessages != null &&
this.pendingAckMessages.contains(position)) {
+ log.warn("[{}][{}] Invalid acks position conflict
with an ongoing transaction:{}.",
+ topicName, subName,
this.pendingCumulativeAckTxnId.toString());
+ return;
Review comment:
if consumer ack 1,2,3,4,5 and 1 is acknowledged by ongoing transaction, is
2,3,4,5 can not be acked?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services