gortiz commented on code in PR #15571:
URL: https://github.com/apache/pinot/pull/15571#discussion_r2067918455
##########
pinot-common/src/main/java/org/apache/pinot/common/datablock/BaseDataBlock.java:
##########
@@ -402,7 +403,14 @@ public List<ByteBuffer> serialize()
if (_serialized == null) {
_serialized = DataBlockUtils.serialize(this);
}
- return _serialized;
+ // Return a copy of the serialized data to avoid external modification.
+ List<ByteBuffer> copy = new ArrayList<>(_serialized.size());
+ for (ByteBuffer page: _serialized) {
+ ByteBuffer pageCopy = page.duplicate();
+ pageCopy.order(page.order());
+ copy.add(pageCopy);
+ }
+ return copy;
Review Comment:
Exactly. And we only cache the serialization buffers because in the current
code it is not easy to serialize blocks only once. It would be cleaner to
serialize once at mailbox send operator and then send these bytes to each
SendingMailbox, but there are sending mailboxes (ie InMemorySendingMailbox)
that prefer the heap object, so we would need to refactor the code a bit.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]