codelipenghui commented on code in PR #16758:
URL: https://github.com/apache/pulsar/pull/16758#discussion_r943400761
##########
pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/TxnLogBufferedWriter.java:
##########
@@ -210,9 +210,15 @@ public void asyncAddData(T data, AddDataCallback callback,
Object ctx){
return;
}
singleThreadExecutorForWrite.execute(() -> {
+ int recordsCountBeforeAdd = dataArray.size();
try {
internalAsyncAddData(data, callback, ctx);
} catch (Exception e){
+ // Avoid missing callback, do failed callback when error occur
before add data to the array.
+ int recordsCountAfter = dataArray.size();
+ if (recordsCountAfter == recordsCountBeforeAdd){
+ callback.addFailed(new
ManagedLedgerException.ManagedLedgerFencedException(e), ctx);
Review Comment:
I agree, we should not throw ManagedLedgerException out of ManagedLedger.
IMO, we should use `PersistenceException` instead.
--
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]