Demogorgon314 commented on code in PR #21091:
URL: https://github.com/apache/pulsar/pull/21091#discussion_r1312630264


##########
pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchMessageContainerImpl.java:
##########
@@ -90,6 +91,23 @@ public void setCryptoKeyReader(CryptoKeyReader 
cryptoKeyReader) {
         this.cryptoKeyReader = cryptoKeyReader;
     }
 
+    @Override
+    public boolean add(MessageImpl<?> msg, SendCallback callback) {
+        this.lastAddedMessageId = (MessageIdImpl) msg.getMessageId();
+        return super.add(msg, callback);
+    }
+
+    @Override
+    public boolean haveEnoughSpace(MessageImpl<?> msg) {
+        if (lastAddedMessageId == null) {
+            return true;
+        }
+        // Keep same batch compact to same batch.
+        MessageIdImpl msgId = (MessageIdImpl) msg.getMessageId();
+        return msgId.getLedgerId() == lastAddedMessageId.getLedgerId()
+                && msgId.getEntryId() == lastAddedMessageId.getEntryId();

Review Comment:
   I only want to compare the `LedgerId` and `EntryId`. Can the 
`MessageIdAdvUtils#equals` method do that?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to