thetumbled commented on code in PR #22024:
URL: https://github.com/apache/pulsar/pull/22024#discussion_r1493924929


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:
##########
@@ -287,8 +287,8 @@ private void handleTransactionMessage(TxnID txnId, Position 
position) {
                 .checkAbortedTransaction(txnId)) {
             ongoingTxns.put(txnId, (PositionImpl) position);
             PositionImpl firstPosition = 
ongoingTxns.get(ongoingTxns.firstKey());
-            //max read position is less than first ongoing transaction message 
position, so entryId -1
-            maxReadPosition = PositionImpl.get(firstPosition.getLedgerId(), 
firstPosition.getEntryId() - 1);
+            // max read position is less than first ongoing transaction 
message position
+            maxReadPosition = getPreviousPosition(firstPosition);

Review Comment:
   There are two places that we need to get the previous position, but they are 
not consistent. We have better make them consistent.
   
https://github.com/apache/pulsar/blob/825e997216dabe23a6dde0945ef769bbda0558e4/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java#L290-L291
   
   
https://github.com/apache/pulsar/blob/825e997216dabe23a6dde0945ef769bbda0558e4/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java#L449-L450



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