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 2019/10/14 01:30:31 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #5378: Trim messages which less than mark delete position for message redelivery

merlimat commented on a change in pull request #5378: Trim messages which less than mark delete position for message redelivery
URL: https://github.com/apache/pulsar/pull/5378#discussion_r334309773
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java
 ##########
 @@ -971,19 +971,24 @@ public synchronized void redeliverUnacknowledgedMessages(Consumer consumer, List
                     (PositionImpl) this.pendingCumulativeAckMessage;
 
             positions.forEach(position -> {
-                if ((pendingAckMessages == null || (pendingAckMessages != null &&
-                        !this.pendingAckMessages.contains(position))) &&
-                        (null == cumulativeAckPosition ||
-                                (null != cumulativeAckPosition && position.compareTo(cumulativeAckPosition) > 0))) {
+                if ((pendingAckMessages == null || !this.pendingAckMessages.contains(position))
+                        && (null == cumulativeAckPosition || position.compareTo(cumulativeAckPosition) > 0)) {
                     pendingPositions.add(position);
                 }
             });
-            dispatcher.redeliverUnacknowledgedMessages(consumer, pendingPositions);
+            dispatcher.redeliverUnacknowledgedMessages(consumer, trimByMarkDeletePosition(pendingPositions));
         } else {
-            dispatcher.redeliverUnacknowledgedMessages(consumer, positions);
+            dispatcher.redeliverUnacknowledgedMessages(consumer, trimByMarkDeletePosition(positions));
         }
     }
 
+    private List<PositionImpl> trimByMarkDeletePosition(List<PositionImpl> positions) {
 
 Review comment:
   This is applying this filtering which generates a lot of temp objects each time these redeliveries are done. Why not clear the map when the clear-backlog or seek commands are issued?

----------------------------------------------------------------
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


With regards,
Apache Git Services