Merge pull request #16986 from rmuir/mmap_java9

Enable unmap hack for java 9
This commit is contained in:
Robert Muir 2016-03-07 15:22:55 -05:00
commit 2dd8ed90ab
3 changed files with 10 additions and 2 deletions

View File

@ -33,7 +33,10 @@ grant codeBase "${codebase.securesm-1.0.jar}" {
grant codeBase "${codebase.lucene-core-6.0.0-snapshot-bea235f.jar}" {
// needed to allow MMapDirectory's "unmap hack" (die unmap hack, die)
// java 8 package
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
// java 9 "package"
permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.ref";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
// NOTE: also needed for RAMUsageEstimator size calculations
permission java.lang.RuntimePermission "accessDeclaredMembers";

View File

@ -109,7 +109,12 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
logger.info("--> check that old primary shard does not get promoted to primary again");
// kick reroute and wait for all shard states to be fetched
client(master).admin().cluster().prepareReroute().get();
assertBusy(() -> assertThat(internalCluster().getInstance(GatewayAllocator.class, master).getNumberOfInFlightFetch(), equalTo(0)));
assertBusy(new Runnable() {
@Override
public void run() {
assertThat(internalCluster().getInstance(GatewayAllocator.class, master).getNumberOfInFlightFetch(), equalTo(0));
}
});
// kick reroute a second time and check that all shards are unassigned
assertThat(client(master).admin().cluster().prepareReroute().get().getState().getRoutingNodes().unassigned().size(), equalTo(2));
}

View File

@ -364,6 +364,6 @@ public class LuceneTests extends ESTestCase {
*/
public void testMMapHackSupported() throws Exception {
// add assume's here if needed for certain platforms, but we should know if it does not work.
assertTrue(MMapDirectory.UNMAP_SUPPORTED);
assertTrue("MMapDirectory does not support unmapping: " + MMapDirectory.UNMAP_NOT_SUPPORTED_REASON, MMapDirectory.UNMAP_SUPPORTED);
}
}