liangyepianzhou commented on code in PR #22707:
URL: https://github.com/apache/pulsar/pull/22707#discussion_r1635176114
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:
##########
@@ -459,6 +464,8 @@ void removeTxnAndUpdateMaxReadPosition(TxnID txnID) {
} else {
updateMaxReadPosition((PositionImpl)
topic.getManagedLedger().getLastConfirmedEntry(), false);
}
+ // Update the last dispatchable position to null if there is a TXN
finished.
+ updateLastDispatchablePosition(null);
Review Comment:
Oh, Sorry, I overlooked this. If you do not set it to null here, but set a
flag that requires reading BK, you can reduce the response time of the next
request. I mentioned
[here](https://github.com/apache/pulsar/pull/22707/#discussion_r1626241035)
before, but maybe not in detail.
1. end txn.
2. set a flag 'readFromBK' as true
3. update normal message
4. set a flag 'readFromBK' as false
5. when call `getLastDispatchablePosition`, if the flag == true, the
`lastDispatchablePosition ` is valid to return. And read from BK after return.
6. Call `getLastDispatchablePosition` again, it can get the last
`getLastDispatchablePosition`.
How do you think about this?
--
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]