codelipenghui commented on code in PR #15424:
URL: https://github.com/apache/pulsar/pull/15424#discussion_r867595749
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:
##########
@@ -240,6 +244,13 @@ public CompletableFuture<Void>
checkIfTBRecoverCompletely(boolean isTxnEnabled)
@Override
public CompletableFuture<Position> appendBufferToTxn(TxnID txnId, long
sequenceId, ByteBuf buffer) {
CompletableFuture<Position> completableFuture = new
CompletableFuture<>();
+ Long lowWaterMark = lowWaterMarks.get(txnId.getMostSigBits());
+ if (lowWaterMark != null && lowWaterMark >= txnId.getLeastSigBits()) {
+ completableFuture.completeExceptionally(new
TransactionBufferException
+ .TransactionNotFoundException("Transaction [" + txnId + "]
has been ended. "
+ + "Please use a new transaction to send message."));
+ return completableFuture;
Review Comment:
Please check here
https://github.com/apache/pulsar/blob/4f53e8eedc8aca406f60ab4c1f7bc11577a6bf20/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L2977-L2984
The TransactionNotFoundException will be wrapped with
ManagedLedgerException. It should be wrapped by PersistenceException directly?
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/TransactionTest.java:
##########
@@ -971,4 +972,21 @@ public void testPendingAckMarkDeletePosition() throws
Exception {
Integer.parseInt(lastConfirmedEntry[1]) - 2);
});
}
+
+ @Test
+ public void testTBLowWaterMark() throws Exception {
Review Comment:
Please also add an end to end test to make sure the client-side can handle
the new exception well.
--
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]