diff --git a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java index c6beadde5a355..1b6c6e9617574 100644 --- a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java +++ b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java @@ -219,11 +219,8 @@ public void safeRun() { EntryImpl entry = EntryImpl.create(ledger.getId(), entryId, data); // EntryCache.insert: duplicates entry by allocating new entry and data. so, recycle entry after calling // insert - // Entry cache doesn't copy the data if entry already exist into the cache. - // Backlog read tries to add entry into cache which can try to add duplicate entry into cache. - if (ml.entryCache.insert(entry)) { - entry.release(); - } + ml.entryCache.insert(entry); + entry.release(); } PositionImpl lastEntry = PositionImpl.get(ledger.getId(), entryId);