lhotari commented on code in PR #12258:
URL: https://github.com/apache/pulsar/pull/12258#discussion_r940952893


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -213,8 +213,11 @@ 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
-            ml.entryCache.insert(entry);
-            entry.release();
+            // 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();
+            }

Review Comment:
   I created #17007 to revert this.



-- 
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]

Reply via email to