BewareMyPower commented on pull request #10330: URL: https://github.com/apache/pulsar/pull/10330#issuecomment-825875852
@dlg99 I just found there's something wrong with @codelipenghui 's analysis, which leads to a result that your PR didn't work. We can debug `BrokerEntryMetadataE2ETest` and go to https://github.com/apache/pulsar/blob/5a7ba52193c069bc40705bcdc74287aae1066b17/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java#L123-L128 - The original `data` is `io.netty.buffer.CompositeByteBuf` - However, `duplicateBuffer` is `io.netty.buffer.UnpooledDuplicatedByteBuf` So the argument type, which is passed to `LedgerHandle#asyncAddEntry`, is `UnpooledDuplicatedByteBuf` not `CompositeByteBuf`. ---- Though I tried to change the code above to ```java ByteBuf duplicateBuffer = data.retainedDuplicate(); final ByteBuf originalData = data; data = duplicateBuffer; // internally asyncAddEntry() will take the ownership of the buffer and release it at the end addOpCount = ManagedLedgerImpl.ADD_OP_COUNT_UPDATER.incrementAndGet(ml); lastInitTime = System.nanoTime(); ledger.asyncAddEntry(originalData, this, addOpCount); ``` But it still didn't work. I'll take a look later. -- 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. For queries about this service, please contact Infrastructure at: [email protected]
