thecoop commented on code in PR #16883:
URL: https://github.com/apache/lucene/pull/16883#discussion_r4361477846
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundReader.java:
##########
@@ -176,28 +184,31 @@ public IndexInput openInput(String name, IOContext
context) throws IOException {
+ entries.keySet()
+ ")");
}
- IndexInput data = context.context() == IOContext.Context.MERGE ?
mergeHandle() : handle;
- return data.slice(name, entry.offset, entry.length, context);
- }
-
- /**
- * A merge reads through a mapping of its own, so the access it advises does
not replace the
- * advice of searches reading the same inner files. Merges of this segment
share it. Like the
- * search mapping, it is opened without advice: each inner file is advised
on its own region.
- */
- private synchronized IndexInput mergeHandle() throws IOException {
- if (closed) {
- throw new AlreadyClosedException("this Directory is closed");
- }
- if (mergeHandle == null) {
+ synchronized (this) {
+ if (closed) {
+ throw new AlreadyClosedException("this Directory is closed");
+ }
+ for (Copy copy : copies) {
+ // an inner file keeps the advice it was first opened with on a copy
+ IOContext first = copy.contexts().putIfAbsent(id, context);
+ IndexInput slice =
+ copy.data().slice(name, entry.offset, entry.length, first == null
? context : first);
Review Comment:
It's worth noting slices don't need to be closed - doesn't matter if this is
actually not used
--
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]