liangyepianzhou commented on a change in pull request #12386:
URL: https://github.com/apache/pulsar/pull/12386#discussion_r731793677



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
##########
@@ -455,9 +455,14 @@ public void 
syncMaxReadPositionForNormalPublish(PositionImpl position) {
         // when ongoing transaction is empty, proved that lastAddConfirm is 
can read max position, because callback
         // thread is the same tread, in this time the lastAddConfirm don't 
content transaction message.
         synchronized (TopicTransactionBuffer.this) {
-            if (ongoingTxns.isEmpty()) {
+            if (checkIfNoSnapshot()) {
                 maxReadPosition = position;
                 changeMaxReadPositionAndAddAbortTimes.incrementAndGet();
+            } else if (checkIfReady()) {
+                if (ongoingTxns.isEmpty()) {

Review comment:
       When transaction aborted or committed, maxReadPosition will be updated. 
In addition, the transaction has a timeout mechanism, and the transaction will 
be aborted after the timeout.




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