lhotari commented on a change in pull request #14556:
URL: https://github.com/apache/pulsar/pull/14556#discussion_r819350493
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java
##########
@@ -145,9 +145,10 @@ public int
filterEntriesForConsumer(Optional<EntryWrapper[]> entryWrapper, int e
MessageMetadata msgMetadata = entryWrapper.isPresent() &&
entryWrapper.get()[entryWrapperIndex] != null
? entryWrapper.get()[entryWrapperIndex].getMetadata()
: null;
- msgMetadata = msgMetadata == null
- ? Commands.peekMessageMetadata(metadataAndPayload,
subscription.toString(), -1)
- : msgMetadata;
+ if (msgMetadata == null) {
Review comment:
I took a look in the possible refactoring. there's a number of fields
that are used from MessageMetadata, so it would turn out to be an ugly
solution.
It's possible that a copy isn't necessary in this case, but it's hard to
tell without checking all accesses. That's why a "defensive copy" is reasonable.
--
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]