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 02:00:40 UTC

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

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

 ##########
 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:
   Replace with removeIf(), please take a look.

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