merlimat commented on a change in pull request #5443: [pulsar-client] Fix 
message corruption on OOM for batch messages
URL: https://github.com/apache/pulsar/pull/5443#discussion_r337779689
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java
 ##########
 @@ -82,11 +82,32 @@ public void add(MessageImpl<?> msg, SendCallback callback) 
{
     }
 
     private ByteBuf getCompressedBatchMetadataAndPayload() {
-        for (MessageImpl<?> msg : messages) {
+        batchedMessageMetadataAndPayload.markWriterIndex();
+        batchedMessageMetadataAndPayload.markReaderIndex();
+        int lastSerializedMessageIndex = 0;
+        
+        for(MessageImpl<?> msg : messages) {
 
 Review comment:
   ```suggestion
           for (int i = 0, n = messages.size(); i < n; i++) {
               MessageImpl<?> msg = messages.get(i);
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to