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


##########
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:
   >@coderzc Yes, But we are unable to do more optimizations, TransactionBuffer 
didn't record aborted messages' position.
   
   But we can try to record somethings(maybe a map for ongoing transaction id 
-> max position) in the TransactionBuffer to resolve this issue.



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