coderzc commented on code in PR #22610:
URL: https://github.com/apache/pulsar/pull/22610#discussion_r1582519352


##########
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:
   This will search forward one by one until a valid position is found, this 
performance very low if the transaction has a lot of abort messages.



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