You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/06/01 06:46:28 UTC

[GitHub] [pulsar] massakam commented on a change in pull request #10762: [broker] Fix issue that message ordering could be broken when redelivering messages on Key_Shared subscription

massakam commented on a change in pull request #10762:
URL: https://github.com/apache/pulsar/pull/10762#discussion_r642824270



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java
##########
@@ -697,20 +698,22 @@ public boolean isConsumerAvailable(Consumer consumer) {
 
     @Override
     public synchronized void redeliverUnacknowledgedMessages(Consumer consumer) {
-        consumer.getPendingAcks().forEach((ledgerId, entryId, batchSize, none) -> {
-            addMessageToReplay(ledgerId, entryId);
+        consumer.getPendingAcks().forEach((ledgerId, entryId, batchSize, stickyKeyHash) -> {
+            addMessageToReplay(ledgerId, entryId, stickyKeyHash);
         });
         if (log.isDebugEnabled()) {
             log.debug("[{}-{}] Redelivering unacknowledged messages for consumer {}", name, consumer,
-                    messagesToRedeliver);
+                    redeliveryMessages);
         }
         readMoreEntries();
     }
 
     @Override
     public synchronized void redeliverUnacknowledgedMessages(Consumer consumer, List<PositionImpl> positions) {
         positions.forEach(position -> {
-            if (addMessageToReplay(position.getLedgerId(), position.getEntryId())) {
+            // TODO: We want to pass a sticky key hash as a third argument to guarantee the order of the messages
+            // on Key_Shared subscription, but it's difficult to get the sticky key here
+            if (addMessageToReplay(position.getLedgerId(), position.getEntryId(), null)) {

Review comment:
       This method is executed when redelivery is requested from the consumer side (e.g. negative ack, ack timeout). So the user should allow the messages to be out of order in this case.




-- 
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:
users@infra.apache.org