msokolov commented on code in PR #12844:
URL: https://github.com/apache/lucene/pull/12844#discussion_r1408025348


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborArray.java:
##########
@@ -31,18 +33,21 @@
  *
  * @lucene.internal
  */
-public class NeighborArray {
+public class NeighborArray implements Accountable {
+  private static final int INITIAL_CAPACITY = 10;

Review Comment:
   OK I believe it's safe to grow on demand because the concurrent impl is used 
only when merging, and in that case we add the initial set of nodes on one 
thread and then NeighborArray is only updated when adding reciprocal neighbors 
(in HnswGraphBuilder.addDiverseNeighbors), where we acquire a write lock that 
should prevent concurrent updates. Basically - we already handle 
synchronization around these arrays for the purpose of adding/removing entries, 
so we should be free to resize (and replace the array pointer) in those cases.



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

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


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

Reply via email to