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


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/RangeCache.java:
##########
@@ -116,7 +148,11 @@ V getValue(K key) {
                 localValue = this.value;
                 lock.unlockRead(stamp);
             }
-            if (localKey != key) {
+            // check that the given key matches the key associated with the 
value in the entry

Review Comment:
   > What happens when this wrapper is recycled and has a new value for the 
same key, after this line? Are we ok to return the old value here?
   
   The value would be returned from this method. There's additional logic in 
the now extracted `getRetainedValueMatchingKey` method. The method contains 
verbose comments explaining the way that it's ensured that a recycled value is 
never returned from the public methods of RangeCache.



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