stillalex commented on code in PR #2021:
URL: https://github.com/apache/solr/pull/2021#discussion_r1364221046


##########
solr/core/src/java/org/apache/solr/update/VersionInfo.java:
##########
@@ -205,9 +215,59 @@ public VersionBucket bucket(int hash) {
     // Make sure high bits are moved down, since only the low bits will matter.
     // int h = hash + (hash >>> 8) + (hash >>> 16) + (hash >>> 24);
     // Assume good hash codes for now.
+    int slot = hash & (numBuckets - 1);
+    if (bucketMap != null) {
+      return getBucketFromMap(slot);
+    }
+    return getBucketFromArray(slot);
+  }
 
-    int slot = hash & (buckets.length - 1);
-    return buckets[slot];
+  private VersionBucket getBucketFromMap(int slot) {
+    VersionBucket bucket = bucketMap.get(slot);
+    if (bucket == null) {
+      synchronized (bucketsSync) {
+        int index = bucketMap.indexOf(slot);

Review Comment:
   is this a potential NPE? if a thread is waiting on the lock while in the 
background the map turns into an array. thread gets the lock, does a 
`bucketMap.indexOf` but the bucketMap is null by the transformation.



-- 
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...@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to