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


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/RangeCache.java:
##########
@@ -106,7 +106,7 @@ K getKey() {
             return localKey;
         }
 
-        V getValue(K key) {
+        V getValue(K key, boolean requireSameKeyInstance) {

Review Comment:
   @eolivelli I made a second attempt to refactor the code based on your review 
comment. PTAL. The RangeCache design is intentionally racy without any 
exclusive locks and since the values are reference counted recycled objects, it 
has resulted in this solution where consistency is checked with the solution 
that is fairly complex. 
   After applying this solution, I haven't seen reports about bugs where the 
root cause was that there were races in RangeCache eviction and cache usage. 
Some of the complexity would be reduced if we wouldn't recycle the EntryWrapper 
instances in RangeCache. However that comes with a tradeoff regarding GC. 
Extensively testing performance could shade more light in actual differences in 
practice.



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