uschindler commented on a change in pull request #177:
URL: https://github.com/apache/lucene/pull/177#discussion_r647659344



##########
File path: lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
##########
@@ -231,55 +224,60 @@ public IndexInput openInput(String name, IOContext 
context) throws IOException {
     ensureOpen();
     ensureCanRead(name);
     Path path = directory.resolve(name);
-    try (FileChannel c = FileChannel.open(path, StandardOpenOption.READ)) {
-      final String resourceDescription = "MMapIndexInput(path=\"" + 
path.toString() + "\")";
-      final boolean useUnmap = getUseUnmap();
-      return ByteBufferIndexInput.newInstance(
-          resourceDescription,
-          map(resourceDescription, c, 0, c.size()),
-          c.size(),
-          chunkSizePower,
-          new ByteBufferGuard(resourceDescription, useUnmap ? CLEANER : null));
+    final String resourceDescription = "MemorySegmentIndexInput(path=\"" + 
path.toString() + "\")";
+    final long fileSize = Files.size(path);
+
+    boolean success = false;
+    final ResourceScope scope = ResourceScope.newSharedScope();
+    try {
+      final MemorySegment[] segments = map(scope, resourceDescription, path, 
fileSize);
+      final IndexInput in =
+          MemorySegmentIndexInput.newInstance(
+              resourceDescription, scope, segments, fileSize, chunkSizePower);
+      success = true;
+      return in;

Review comment:
       It's closed here: 
https://github.com/apache/lucene/pull/177/files/6d16a8d0984c73ddb32fced02a180b1a688662c1#diff-1c8534e50633cd8648f2cb3c886a269a6ebf8a57d817885bd962225d83f4e93fR456




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

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