lordcheng10 commented on a change in pull request #3061:
URL: https://github.com/apache/bookkeeper/pull/3061#discussion_r809629204



##########
File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/util/collections/ConcurrentLongLongPairHashMap.java
##########
@@ -336,9 +339,10 @@ boolean put(long key1, long key2, long value1, long 
value2, int keyHash, boolean
                     bucket = (bucket + 4) & (table.length - 1);
                 }
             } finally {
-                if (usedBuckets > resizeThreshold) {
+                if (usedBuckets > resizeThresholdUp) {
                     try {
-                        rehash();
+                        // Expand the hashmap
+                        rehash(capacity * 2);

Review comment:
       @merlimat  like this?:
   float upFactor = 0.5;
   float downFactor = 0.5;
   
   // Expand the hashmap
   rehash(capacity * (1 + upFactor));
   
   // shrink the hashmap
   rehash(capacity * (1-downFactor));




-- 
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: issues-unsubscr...@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to