[ 
https://issues.apache.org/jira/browse/LUCENE-10330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17462796#comment-17462796
 ] 

Uwe Schindler commented on LUCENE-10330:
----------------------------------------

I opened a PR: https://github.com/apache/lucene/pull/556

This also cleans up the mmap hack (because it contained some relics from the 
Java 8 era). So {{newBufferCleaner()}} is simpler. It also adds a helpful 
message if for some reason, the module system can't reach out to 
sun.misc.Unsafe.

I also added a hacky test to check if the MMap hack also works well in modular 
work. Unfortunately [~dweiss] removed this test in the 2nd approch to module 
system support.

There is currently no way to disable the MMAP check. Tests will always fails if 
your JDK version does not support unmapping, which is fine in my opinion (as 
everything is OpenJDK based now). In addition, as the lucene.core modules 
requires "jdk.unsupported" it won't work with other JDK anyways.

> Make the mmap directory tests fail by default, if unmapping does not work
> -------------------------------------------------------------------------
>
>                 Key: LUCENE-10330
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10330
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/store
>    Affects Versions: 9.0, 9.1, 10.0 (main)
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Since the recent refactoring with Java modules, we figured out that we have 
> no tests, that MMapDirectory always works correctly and is choosen as 
> default, e.g. because you have a module setup where {{jdk.unsupported}} is 
> missing (last seen on Luke) or since the refactoring of tests after 
> LUCENE-10255 (see also discussion about how tests should be ran with module 
> system in LUCENE-10328).
> Currently TestMMapDirectory and similar ones silently disable themselves if 
> the "Unmap Hack" is not detected. The warning is hidden by gradle, so that's 
> a bad default.
> We should simply fail the test when unmapping does not work and add an option 
> to "still run tests if you know what you're doing". All current Java releases 
> are OpenJDK based (at least those in main/9.x as those use JDK 11), so the 
> unmap hack always works.
> Of course MMapDirectory still disables itsself at runtime (e.g. when security 
> policy is preventing it or if user has module system and does not add it -- 
> we should add this to the warning message), but we should make sure that we 
> test it on known platforms.
> Another option would be to check the assume and modify it to also check the 
> version tring for "OpenJDK", "Oracle" and enforce that test is enabled. But 
> this is too risky, so I would simply fail test if unmapping does not work 
> with a system property to disable checks.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to