dao-jun commented on PR #4317:
URL: https://github.com/apache/bookkeeper/pull/4317#issuecomment-2080276711

   BTW, the key point is 
   ```java
                       int capacity = this.capacity;
                       bucket = signSafeMod(bucket, capacity);
   ```
   and 
   ```java
                       // First try optimistic locking
                       long storedKey = keys[bucket];
                       V storedValue = values[bucket];
   ```
   
   not an atomic operation.
   
   If `rehash` triggered in an async thread *after* calculating `bucket` and 
finished *before* read entry from the array, we will read incorrect value.


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