jimczi commented on code in PR #16749:
URL: https://github.com/apache/lucene/pull/16749#discussion_r4146025625
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99FlatVectorsReader.java:
##########
@@ -312,16 +366,30 @@ public RandomVectorScorer getRandomVectorScorer(String
field, short[] target) th
target);
}
+ /**
+ * Closes the mapping a merge used, once no merge instance holds it. A later
merge maps the file
+ * again.
+ */
@Override
public void finishMerge() throws IOException {
- // This makes sure that the access pattern hint is reverted back since
HNSW implementation
- // needs it
- vectorData.updateIOContext(dataContext);
+ original.releaseMergeVectorData();
+ }
+
+ private synchronized void releaseMergeVectorData() throws IOException {
+ assert original == this;
+ if (--mergeInstances > 0) {
+ return;
+ }
+ if (mergeVectorData != null && mergeVectorData != vectorData) {
+ mergeVectorData.close();
+ }
+ mergeVectorData = null;
}
@Override
public void close() throws IOException {
- IOUtils.close(vectorData);
+ IOUtils.close(
+ vectorData, original == this && mergeVectorData != vectorData ?
mergeVectorData : null);
Review Comment:
Done in `5ad8269`, with your accessor so the close stays outside the lock.
--
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]