This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 669ab6135c3 [improve][ml] Improve cache insert performance by removing 
exists check since it's already covered by putIfAbsent (#24699)
669ab6135c3 is described below

commit 669ab6135c3f44d7ff8afbb4298343492bb6c328
Author: Lari Hotari <[email protected]>
AuthorDate: Thu Sep 4 12:29:28 2025 +0300

    [improve][ml] Improve cache insert performance by removing exists check 
since it's already covered by putIfAbsent (#24699)
---
 .../apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java  | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git 
a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java
 
b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java
index 44056bc44aa..04de8dde0ad 100644
--- 
a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java
+++ 
b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java
@@ -139,12 +139,6 @@ public class RangeEntryCacheImpl implements EntryCache {
                     entryLength);
         }
 
-        Position position = entry.getPosition();
-        if (entries.exists(position)) {
-            // If the entry is already in the cache, don't insert it again
-            return false;
-        }
-
         ByteBuf cachedData;
         if (copyEntries) {
             cachedData = copyEntry(entry);
@@ -156,6 +150,7 @@ public class RangeEntryCacheImpl implements EntryCache {
             cachedData = entry.getDataBuffer().retain();
         }
 
+        Position position = entry.getPosition();
         ReferenceCountedEntry cacheEntry =
                 EntryImpl.createWithRetainedDuplicate(position, cachedData, 
entry.getReadCountHandler());
         cachedData.release();

Reply via email to