zacharymorn commented on pull request #2052: URL: https://github.com/apache/lucene-solr/pull/2052#issuecomment-761623319
> The issue with seek to filesize is well-known to me, that was also my first idea I had yesterday in the evening. But I was ready to go to bed and of course I had a beer, so I was not ready to fix it. > In MMapDirectory rewrite for JDK16+ (see #2176) I have seen similar special cases. We have there partially empty MMAPs (sized 0 bytes) just to allow the seek to end of file. > The issue here was really the block size on Windows which is much smaller so it triggers the failure. Yup I realized this later as well when looking at the bug. In your original implementation you already handled it with the below to not throw exception when at EOF ``` if (n < 0 && filePos > channel.size()) { throw new EOFException("read past EOF: " + this); } ``` But somehow I put in these obviously incompatible code just across a few lines between themselves ``` if(filePos >= channel.size()) { // this condition conflicts with the assertion below throw new EOFException("read past EOF: " + this); } ... try { n = channel.read(buffer, filePos); assert n >= 0 : "read should not past EOF"; } catch (IOException ioe) { ... ``` I guess I'm also a bit surprised that `channel.read` would return -1 to indicate both reading EOF and reading past EOF. Previously I was assuming this will just return 0 for reading EOF. Maybe the underlying JDK implementation is using exception to detect EOF? Will need to look that up. > Sorry that you had to install a Windows VM first. I was on the right plan, too, it was just too late! No problem there. I actually got a relatively powerful NAS lately so I was eager to try out running VMs on it :D > As you are also now familar with IndexInputs, you may also have a look at performance of #2176 !!! Thanks. Thanks for letting me know about this PR! Will definitely take a look! ---------------------------------------------------------------- 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