thecoop commented on code in PR #16905:
URL: https://github.com/apache/lucene/pull/16905#discussion_r4376507135


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99FlatVectorsReader.java:
##########
@@ -385,17 +395,21 @@ public RandomVectorScorer getRandomVectorScorer(String 
field, short[] target) th
 
   @Override
   public void close() throws IOException {
-    IndexInput sequential;
+    List<IndexInput> toClose = new ArrayList<>();
     synchronized (this) {
       if (closed) {
         return;
       }
       closed = true;
-      sequential =
-          original == this && sequentialVectorData != vectorData ? 
sequentialVectorData : null;
-      sequentialVectorData = null;
+      toClose.add(vectorData);
+      for (IndexInput other : otherVectorData.values()) {
+        if (other != vectorData) {
+          toClose.add(other);

Review Comment:
   You could have `toClose` as a `Set`, then it will automatically de-duplicate 
across all instances (also important if you re-add to the map above)



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