BewareMyPower commented on code in PR #24522:
URL: https://github.com/apache/pulsar/pull/24522#discussion_r2210058349


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedLedger.java:
##########
@@ -420,6 +420,13 @@ void asyncOpenCursor(String name, InitialPosition 
initialPosition, Map<String, L
      */
     long getOffloadedSize();
 
+    /**
+     * Reset Exception before write to null.
+     */
+    default void resetExceptionBeforeWrite() {

Review Comment:
   This method is confusing that how should it be implemented for a custom 
managed ledger implementation. Could it be better to introduce `fence` and 
`unfence` mechanisms to managed ledger and call them in the same method of 
`PersistentTopic`?
   
   Besides, I think there might be some other solutions to avoid introducing a 
confusing default method to the managed ledger:
   1. Maintain the exception in `PersistentTopic` in `addFailed` or `fence()` 
and fail the `asyncAddEntry` if the exception is not null. The challenge is 
that though `internalAsyncAddEntry` is synchronized, it's executed in the 
internal executor, so `asyncAddEntry` cannot synchronize the fence operation.
   2. Maintain the exception in managed ledger interceptor.
   
   Just some thoughts, I didn't try these solutions at the moment.



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to