poorbarcode commented on code in PR #22221:
URL: https://github.com/apache/pulsar/pull/22221#discussion_r1565460269
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -1667,9 +1674,7 @@ void createNewOpAddEntryForNewLedger() {
if (existsOp != null) {
// If op is used by another ledger handle, we need to close it
and create a new one
if (existsOp.ledger != null) {
- existsOp.close();
- existsOp = OpAddEntry.createNoRetainBuffer(existsOp.ml,
existsOp.data,
- existsOp.getNumberOfMessages(), existsOp.callback,
existsOp.ctx);
+ existsOp =
existsOp.duplicateAndClose(currentLedgerTimeoutTriggered);
Review Comment:
The `Bytebuf data` will be released after the entry is added completely or
the Managed Ledger is closed. see:
- `OpAddEntry.addComplete` -> `OpAddEntry.run` -> `release ByteBuf`
- `ML.clearPendingAddEntries` -> `OpAddEntry.failed` -> `release ByteBuf`
--
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]