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


##########
pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchMessageContainerImpl.java:
##########
@@ -44,16 +44,17 @@
  * [(k1, v1), (k2, v1), (k3, v1), (k1, v2), (k2, v2), (k3, v2), (k1, v3), (k2, 
v3), (k3, v3)]
  */
 public class RawBatchMessageContainerImpl extends BatchMessageContainerImpl {
-    MessageCrypto msgCrypto;
-    Set<String> encryptionKeys;
-    CryptoKeyReader cryptoKeyReader;
+    private MessageCrypto<MessageMetadata, MessageMetadata> msgCrypto;
+    private Set<String> encryptionKeys;
+    private CryptoKeyReader cryptoKeyReader;
+    private MessageIdImpl lastAddedMessageId;
 
-    public RawBatchMessageContainerImpl(int maxNumMessagesInBatch, int 
maxBytesInBatch) {
+    public RawBatchMessageContainerImpl() {
         super();
         this.compressionType = CompressionType.NONE;
         this.compressor = new CompressionCodecNone();
-        this.maxNumMessagesInBatch = maxNumMessagesInBatch;
-        this.maxBytesInBatch = maxBytesInBatch;
+        this.maxNumMessagesInBatch = Integer.MAX_VALUE;
+        this.maxBytesInBatch = Integer.MAX_VALUE;

Review Comment:
   > if we override it, we need to override the add method as well.
   
   Sorry I didn't get it. I mean, if you made the following changes:
   
   ```diff
   diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchMessageContainerImpl.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchMessageContainerImpl.java
   index a40ab35dab..67df65279b 100644
   --- 
a/pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchMessageContainerImpl.java
   +++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchMessageContainerImpl.java
   @@ -54,8 +54,6 @@ public class RawBatchMessageContainerImpl extends 
BatchMessageContainerImpl {
            super();
            this.compressionType = CompressionType.NONE;
            this.compressor = new CompressionCodecNone();
   -        this.maxNumMessagesInBatch = Integer.MAX_VALUE;
   -        this.maxBytesInBatch = Integer.MAX_VALUE;
        }
        private ByteBuf encrypt(ByteBuf compressedPayload) {
            if (msgCrypto == null) {
   @@ -98,6 +96,11 @@ public class RawBatchMessageContainerImpl extends 
BatchMessageContainerImpl {
            return super.add(msg, callback);
        }
    
   +    @Override
   +    protected boolean isBatchFull() {
   +        return false;
   +    }
   +
        @Override
        public boolean haveEnoughSpace(MessageImpl<?> msg) {
            if (lastAddedMessageId == null) {
   ```
   
   what else should you make in addition?



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