[fix][broker] Release Netty buffer in finally block in ServerCnx#handleLastMessageIdFromCompactedLedger
@@ -2029,6 +2029,7 @@ public class ServerCnx extends PulsarHandler implements TransportCnx {
int partitionIndex, PositionImpl markDeletePosition) {
persistentTopic.getCompactedTopic().readLastEntryOfCompactedLedger().thenAccept(entry -> {
if (entry != null) {
+ try {
// in this case, all the data has been compacted, so return the last position
// in the compacted ledger to the client
ByteBuf payload = entry.getDataBuffer();
@@ -2046,7 +2047,9 @@ public class ServerCnx extends PulsarHandler implements TransportCnx {
entry.getLedgerId(), entry.getEntryId(), partitionIndex, largestBatchIndex,
markDeletePosition != null ? markDeletePosition.getLedgerId() : -1,
markDeletePosition != null ? markDeletePosition.getEntryId() : -1));
+ } finally {
entry.release();
+ }
} else {
// in this case, the ledgers been removed except the current ledger
// and current ledger without any data
