liangyepianzhou commented on code in PR #22707:
URL: https://github.com/apache/pulsar/pull/22707#discussion_r1626241035
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/InMemTransactionBuffer.java:
##########
@@ -307,6 +307,7 @@ public CompletableFuture<Void> commitTxn(TxnID txnID, long
lowWaterMark) {
txnBuffer.commitAt(committedAtLedgerId, committedAtEntryId);
addTxnToTxnIdex(txnID, committedAtLedgerId);
}
+ updateLastDispatchablePosition(null);
Review Comment:
>About why set lastDispatchablePosition to null when commit txn, it is
because of it's hard to determine which position to set, so, set to null to
make it fallback to search the position from BK.
This is a good way for cache lastDispatchablePosition. There are some ways
to do that.
1. your way
2. When committing the transaction, keep the previous position because it
is still the correct position. Then start a task to update, or mark it as
needing to be updated from BK. Then the next time it is read, return to the
previous position that is somewhat lagging but still valid. Then read from BK.
--
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]