BewareMyPower commented on PR #18390:
URL: https://github.com/apache/pulsar/pull/18390#issuecomment-1307215295

   But I'm still not sure about the following logic
   
   ```java
                       // First try optimistic locking
                       long storedKey1 = table[bucket];
                       long storedKey2 = table[bucket + 1];
                       long storedValue1 = table[bucket + 2];
                       long storedValue2 = table[bucket + 3];
   
                       if (!acquiredLock && validate(stamp)) {
                           // The values we have read are consistent
                           if (key1 == storedKey1 && key2 == storedKey2) {
                               return new LongPair(storedValue1, storedValue2);
   ```
   
   Even if storedKey1 and storeKey2 matched the expected keys, are storedValue1 
and storedValue2 guaranteed to be exactly the associated values? This PR 
covered the case that table is shrinking, which makes the index invalid. 
However, could it happen that when retrieving `table[bucket + 2]` and 
`table[bucket + 3]`, these values have been modified? @lhotari @lordcheng10 
@thetumbled 


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