mayya-sharipova commented on code in PR #16794:
URL: https://github.com/apache/lucene/pull/16794#discussion_r4233786214


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswConcurrentMergeBuilder.java:
##########
@@ -318,6 +529,56 @@ public void addGraphNode(int node) throws IOException {
       }
       super.addGraphNode(node);
     }
+
+    /** Adds a node of the join set of a graph being joined, with a full 
search. */
+    private void addJoinSetNode(int node, InsertedNodes inserted) throws 
IOException {
+      // skip the initializedNodes check: the node is marked since it belongs 
to a graph being
+      // joined
+      super.addGraphNode(node);
+      inserted.add(node);
+    }
+
+    /**
+     * Adds a node of a graph being joined that is not in its join set. Like 
{@link
+     * MergingHnswGraphBuilder}, the search on level 0 enters from the node's 
neighbors in that
+     * graph that are already inserted, which includes its join set neighbors, 
and from their
+     * neighbors in the merged graph.
+     *
+     * @param u the node, as an ordinal of the graph being joined
+     */
+    private void addJoinedNode(JoinPlan plan, int u, InsertedNodes inserted) 
throws IOException {
+      int numNeighbors = 0;
+      plan.graphLock.lock();

Review Comment:
   Instead of this lock, could each worker get its own instance per joined 
graph, e.g. by having ConcurrentHnswMerger.createBuilder call getGraph once per 
worker, or by passing an IOSupplier<HnswGraph>? That would remove the lock. It 
costs a few small objects per worker and graph.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to