dao-jun commented on code in PR #22610:
URL: https://github.com/apache/pulsar/pull/22610#discussion_r1582756633


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -3647,7 +3647,14 @@ public CompletableFuture<Position> 
getLastDispatchablePosition() {
             return 
ManagedLedgerImplUtils.asyncGetLastValidPosition((ManagedLedgerImpl) ledger, 
entry -> {
                 MessageMetadata md = 
Commands.parseMessageMetadata(entry.getDataBuffer());
                 // If a messages has marker will filter by 
AbstractBaseDispatcher.filterEntriesForConsumer
-                return !Markers.isServerOnlyMarker(md);
+                if (Markers.isServerOnlyMarker(md)) {
+                    return false;
+                } else if (md.hasTxnidMostBits() && md.hasTxnidLeastBits()) {
+                    // Filter-out transaction aborted messages.
+                    TxnID txnID = new TxnID(md.getTxnidMostBits(), 
md.getTxnidLeastBits());
+                    return !isTxnAborted(txnID, (PositionImpl) 
entry.getPosition());

Review Comment:
   @thetumbled @liangyepianzhou It's a further improvement, I'm going to read 
more entries from ledger(not one by one) to optimize it.



-- 
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]

Reply via email to