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/03/15 21:58:12 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #3830: Fix read batching message by pulsar reader

merlimat commented on a change in pull request #3830: Fix read batching message by pulsar reader
URL: https://github.com/apache/pulsar/pull/3830#discussion_r266159040
 
 

 ##########
 File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
 ##########
 @@ -1431,6 +1428,15 @@ public boolean hasMessageAvailable() throws PulsarClientException {
         return booleanFuture;
     }
 
+    private boolean hasMoreMessages(MessageId lastMessageIdInBroker, MessageId lastDequeuedMessage) {
+        return (lastMessageIdInBroker.compareTo(lastDequeuedMessage) > 0 ||
+                // Make sure batch message can be read completely.
+                lastDequeuedMessage instanceof BatchMessageIdImpl
+                        && lastMessageIdInBroker.compareTo(lastDequeuedMessage) >= 0
+                        && incomingMessages.size() > 0)
+                && ((MessageIdImpl)lastMessageIdInBroker).getEntryId() != -1;
 
 Review comment:
   I think the condition is not correct in current form. I believe it should be like : 
   
   ```java
   if (lastMessageIdInBroker.compareTo(lastDequeuedMessage) > 0 
       ((MessageIdImpl)lastMessageIdInBroker).getEntryId() != -1) {
       return true;
   } else if (lastMessageIdInBroker.compareTo(lastDequeuedMessage) == 0
                  && incomingMessages.size() > 0 ) {
        return true;
   } else {
      return false;
   }
   ``` 

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