coderzc commented on code in PR #21951:
URL: https://github.com/apache/pulsar/pull/21951#discussion_r1462686212
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -2190,6 +2193,77 @@ protected void
handleGetLastMessageId(CommandGetLastMessageId getLastMessageId)
}
}
+ private boolean isValidEntry(MessageMetadata metadata, PersistentTopic
persistentTopic) {
+ if (metadata.hasMarkerType()) {
+ return false;
+ }
+ if (metadata.hasTxnidMostBits() && metadata.hasTxnidLeastBits() &&
persistentTopic.isTxnAborted(
+ new TxnID(metadata.getTxnidMostBits(),
metadata.getTxnidLeastBits()), null)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Get the metadata and position of the largest batch index of the last
valid entry.
+ * some entry need to be filtered, such as marker message.
+ * @param entryMetaDataFuture
+ * @param lastPosition
+ * @param ml
+ */
+ private void readLastValidEntry(CompletableFuture<MessageMetadata>
entryMetaDataFuture,
Review Comment:
This will search forward one by one until a valid position is found, not
sure about the performance.
--
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]