aloyszhang commented on a change in pull request #8618:
URL: https://github.com/apache/pulsar/pull/8618#discussion_r540655866
##########
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 suggestion. I'll optimize the implement as follow steps:
1. expose the entry metadata to MessageImpl
2. if entry metadata exist, skip the deserialization of MessageMetadata
3. if not exist, deserialization the MessageMetadata
----------------------------------------------------------------
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]