mattisonchao commented on code in PR #20337:
URL: https://github.com/apache/pulsar/pull/20337#discussion_r1196199041
##########
pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchConverter.java:
##########
@@ -139,8 +142,22 @@ public static Optional<RawMessage>
rebatchMessage(RawMessage msg,
ByteBuf metadataAndPayload =
Commands.serializeMetadataAndPayload(Commands.ChecksumType.Crc32c,
metadata, compressedPayload);
- Optional<RawMessage> result = Optional.of(new
RawMessageImpl(msg.getMessageIdData(),
-
metadataAndPayload));
+
+ if (brokerEntryMetadata != null) {
+ int brokerMetaSize =
brokerEntryMetadata.getSerializedSize();
+ ByteBuf brokerMeta =
+
PulsarByteBufAllocator.DEFAULT.buffer(brokerMetaSize + 6, brokerMetaSize + 6);
+ brokerMeta.writeShort(Commands.magicBrokerEntryMetadata);
+ brokerMeta.writeInt(brokerMetaSize);
+ brokerEntryMetadata.writeTo(brokerMeta);
+
+ CompositeByteBuf compositeByteBuf =
PulsarByteBufAllocator.DEFAULT.compositeBuffer();
Review Comment:
At first glance, can we make it to be direct memory? Since this relates to
the message number, It should be more pressure on GC.
##########
pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchConverter.java:
##########
@@ -139,8 +142,22 @@ public static Optional<RawMessage>
rebatchMessage(RawMessage msg,
ByteBuf metadataAndPayload =
Commands.serializeMetadataAndPayload(Commands.ChecksumType.Crc32c,
metadata, compressedPayload);
- Optional<RawMessage> result = Optional.of(new
RawMessageImpl(msg.getMessageIdData(),
-
metadataAndPayload));
+
+ if (brokerEntryMetadata != null) {
+ int brokerMetaSize =
brokerEntryMetadata.getSerializedSize();
+ ByteBuf brokerMeta =
+
PulsarByteBufAllocator.DEFAULT.buffer(brokerMetaSize + 6, brokerMetaSize + 6);
+ brokerMeta.writeShort(Commands.magicBrokerEntryMetadata);
+ brokerMeta.writeInt(brokerMetaSize);
+ brokerEntryMetadata.writeTo(brokerMeta);
+
+ CompositeByteBuf compositeByteBuf =
PulsarByteBufAllocator.DEFAULT.compositeBuffer();
Review Comment:
At first glance, can we make it to be direct memory? Since this relates to
the message number, It should be more pressure on GC. :)
--
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]