mayya-sharipova commented on a change in pull request #315:
URL: https://github.com/apache/lucene/pull/315#discussion_r721410089



##########
File path: 
lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsReader.java
##########
@@ -301,55 +349,62 @@ public KnnGraphValues getGraphValues(String field) throws 
IOException {
       throw new IllegalArgumentException("No such field '" + field + "'");
     }
     FieldEntry entry = fields.get(field);
-    if (entry != null && entry.indexDataLength > 0) {
+    if (entry != null && entry.graphIndexLength > 0) {
       return getGraphValues(entry);
     } else {
       return KnnGraphValues.EMPTY;
     }
   }
 
   private KnnGraphValues getGraphValues(FieldEntry entry) throws IOException {
+    if (entry.ordOffsetsByLevel == null) {
+      synchronized (entry) {

Review comment:
       @rmuir Thanks for checking.  Good to know that we don't encourage lazy 
loading, and I will revert this change from this PR, and avoid doing lazy 
loading in the future.
   
   The problem with the current code is that we load all the graph data into 
memory in the Reader constructor,  why may instantiate this reader many times, 
and for some of these times we don't need the graph data (e.g. if we just do 
CheckIndex).  But we have a plan to address this to use instead off-heap graph 
data.  




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