jimczi commented on code in PR #16749:
URL: https://github.com/apache/lucene/pull/16749#discussion_r4143970842


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99FlatVectorsReader.java:
##########
@@ -185,9 +210,38 @@ public void checkIntegrity(MergePolicy.OneMerge merge) 
throws IOException {
 
   @Override
   public FlatVectorsReader getMergeInstance() throws IOException {
-    // Update the read advice since vectors are guaranteed to be accessed 
sequentially for merge
-    
vectorData.updateIOContext(dataContext.withHints(DataAccessHint.SEQUENTIAL));
-    return this;
+    return new Lucene99FlatVectorsReader(this, 
original.mergeVectorData().clone());
+  }
+
+  /**
+   * The vectors as a merge reads them, front to back and once. Advice belongs 
to a mapping, so a
+   * merge maps the file again. Mapped on the first merge, released by {@link 
#finishMerge()}.
+   */
+  private synchronized IndexInput mergeVectorData() throws IOException {
+    assert original == this;
+    mergeInstances++;

Review Comment:
   Good catch, thanks. Fixed in `8627ad2`: the increment now happens after the 
mapping is open, and `getMergeInstance` undoes it if the clone throws. Added a 
test for the failed open, and one for a merge instance nobody finishes.



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