dao-jun commented on code in PR #24522:
URL: https://github.com/apache/pulsar/pull/24522#discussion_r2225778278
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -132,8 +132,16 @@ public void setCloseWhenDone(boolean closeWhenDone) {
public void initiate() {
if (STATE_UPDATER.compareAndSet(OpAddEntry.this, State.OPEN,
State.INITIATED)) {
- ByteBuf duplicateBuffer = data.retainedDuplicate();
+ // Fail the add operation if the managed ledger is in a state that
prevents adding entries.
+ ManagedLedgerException exbw = ml.interceptorException;
+ if (exbw != null) {
+ ml.pendingAddEntries.remove(this);
+ this.failed(exbw);
+ // Don't recycle the object here, see:
https://lists.apache.org/thread/po08w0tkhc7q8gc5khpdft6stxnr1v2y
+ return;
+ }
Review Comment:
The ML's state is very complex and it's core of the messaging and there is
no precedent of the case.
FencedForDeletion, Fenced is the final state of the ML, WriteFailed is for
create ledger failed, and since it's the failure before write to BK, we don't
have a strong reason to close the current ledger and create a new one.
how about we just we just rename rename `resetInterceptorException()` to
`unfenceForInterceptorException()` ?
--
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]