gaoran10 commented on code in PR #24522:
URL: https://github.com/apache/pulsar/pull/24522#discussion_r2213094723
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -143,10 +152,13 @@ public void initiate() {
payloadProcessorHandle = ml.getManagedLedgerInterceptor()
.processPayloadBeforeLedgerWrite(this.getCtx(),
duplicateBuffer);
} catch (Exception e) {
+ ManagedLedgerException mle = new
ManagedLedgerException.ManagedLedgerInterceptException(e);
+ ml.exceptionBeforeWrite = mle;
ml.pendingAddEntries.remove(this);
ReferenceCountUtil.safeRelease(duplicateBuffer);
log.error("[{}] Error processing payload before ledger
write", ml.getName(), e);
- this.failed(new
ManagedLedgerException.ManagedLedgerInterceptException(e));
+ this.failed(mle);
+ recycle();
Review Comment:
Hi, @lhotari , could you explain the potential issue?
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedLedger.java:
##########
@@ -420,6 +420,23 @@ void asyncOpenCursor(String name, InitialPosition
initialPosition, Map<String, L
*/
long getOffloadedSize();
+ /**
+ * Resets the exception thrown by the PayloadProcessor during an add entry
operation to null.
+ * <p>
+ * **Context:** When an add entry operation fails due to an interceptor,
all subsequent incoming add entry
+ * operations will also fail. This behavior ensures message ordering and
consistency.
+ * <p>
+ * **Important:** This method MUST only be called after all pending add
operations are fully completed
+ * (e.g., after a Topic is unfenced). Calling it prematurely will prevent
the Managed Ledger (ML)
+ * from being able to write indefinitely.
+ * <p>
+ * **Implementation Note:** Downstream projects that support the ML
PayloadProcessor should implement
Review Comment:
Sorry, why should the ML PayloadProcessor implement this method? Do you mean
the PayloadProcessor can perform some operation in this method? Such as
resource clean-up.
--
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]