uschindler commented on PR #13337:
URL: https://github.com/apache/lucene/pull/13337#issuecomment-2096280645

   Hi, give me some time to review. I got the concept! I also have some 
questions about the NIOFS one because I don't like to use twice as much file 
handles just for the prefetching.
   
   MMap: the pagesize problem is well known. You are not the first one hitting 
this. I worked aorund it with some hack, too: 
https://github.com/apache/lucene/blob/40cae087f71a875478309abfc4b1ab1e7b027cab/lucene/core/src/java21/org/apache/lucene/store/MemorySegmentIndexInputProvider.java#L117-L119
   
   The problem with page size is: It is known everywhere in the JDK and 
available via Unsafe and various other places, but all are private. I 
temporarily tried to add a workaround to use another glibc call to retrieve the 
page size, but this failes due to differences in enum constants on different 
platforms (the SC_PAGESIZE constant has a different value on various 
linux/macos versions) because its a C enum and has no fixed value. So we cannot 
easily get the page size without hardcoding an integer constant which is not 
even defined in any header file. The alternative is to use the 
deprecated/outdated 
[getpagesize()](https://man7.org/linux/man-pages/man2/getpagesize.2.html) 
function on libc.... But I don't want to use it as its not posix 
standardized....
   
   What do you think about this workaround: use 4 K as pagesize, but guard with 
try/catch and do nothing on IOExc (if unaliged)?
   
   I was about to open an issue on JDK to somehow allow to get page size from 
JVM in the MemorySegment API because you need it quite often when using them.


-- 
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: issues-unsubscr...@lucene.apache.org

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