aloyszhang commented on a change in pull request #8618:
URL: https://github.com/apache/pulsar/pull/8618#discussion_r540651818
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java
##########
@@ -68,16 +70,22 @@ public void expireMessages(int messageTTLInSeconds) {
messageTTLInSeconds);
cursor.asyncFindNewestMatching(ManagedCursor.FindPositionConstraint.SearchActiveEntries,
entry -> {
- MessageImpl<?> msg = null;
+ Pair<MessageImpl<byte[]>, PulsarApi.BrokerEntryMetadata> pair
= null;
try {
- msg = MessageImpl.deserialize(entry.getDataBuffer());
- return msg.isExpired(messageTTLInSeconds);
+ pair =
MessageImpl.deserializeWithBrokerEntryMetaData(entry.getDataBuffer());
Review comment:
Nice susggestion. I'll optimize the implement :
1. expose entry metadata to MessageImpl to avoid `if-else` logic
2. skip deserialize the MessageMetadata if Entry has entry metadata
----------------------------------------------------------------
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]