NightOwl888 commented on code in PR #1138:
URL: https://github.com/apache/lucenenet/pull/1138#discussion_r1989739447


##########
src/Lucene.Net/Store/MMapDirectory.cs:
##########
@@ -314,7 +314,7 @@ internal virtual ByteBuffer[] Map(MMapIndexInput input, 
FileStream fc, long offs
                 input.memoryMappedFile = MemoryMappedFile.CreateFromFile(
                     fileStream: fc,
                     mapName: null,
-                    capacity: length,
+                    capacity: fc.Length, // use the full length of the file

Review Comment:
   It wasn't related to this test. The "hole" was added in 
10b326a850570b4d25fa837f85083ba1eb34d0be to fix #356. I haven't tested to see 
whether the `SharingNativeFSLock` fails when the first file is opened with 
`FileShare.Read`, though. It is just a suspect. I wasn't sure about this "fix" 
when it was added, but it seemed to work (up until now when we discovered it 
doesn't always work).
   
   The `NativeFSLockFactory` needs unit tests for each OS and `NativeFSLock` 
implementation, but it might be better to wait until after we consider whether 
to change the approach to use native method calls.



-- 
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: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to