Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JDK11 support and enable in CI #31644

Merged
merged 30 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d26bf2a
Upgrade bouncycastle
alpar-t Jun 12, 2018
e132892
Downgrade bouncycastle to avoid invalid manifest
alpar-t Jun 13, 2018
efe1844
Add checksum for new jars
alpar-t Jun 13, 2018
3acd7b5
Update tika permissions for jdk 11
alpar-t Jun 13, 2018
283b708
Mute test failing on jdk 11
alpar-t Jun 13, 2018
6091a3f
Thread#stop(Throwable) was removed
alpar-t Jun 18, 2018
0060bb7
Add JDK11 to CI
alpar-t Jun 15, 2018
e433bce
Disable failing tests #31456
alpar-t Jun 20, 2018
be6fe54
Temprorarily disable doc tests
alpar-t Jun 20, 2018
dbe3a08
Only blacklist specific doc tests
alpar-t Jun 21, 2018
6e10477
Disable only failing tests in ingest attachment plugin
alpar-t Jun 21, 2018
aae1184
Mute failing HDFS tests #31498
alpar-t Jun 21, 2018
d7e299e
Mute failing lang-painless tests #31500
alpar-t Jun 21, 2018
a7a49db
Fix backwards compatability builds
alpar-t Jun 22, 2018
da094bc
Add 6.x to bwx -> java10
alpar-t Jun 22, 2018
06763cc
Prefix out and err from buildBwcVersion for readability
alpar-t Jun 22, 2018
00d3b7e
Also set RUNTIME_JAVA_HOME for bwcBuild
alpar-t Jun 22, 2018
1c19cf8
Align bouncycastle dependency
alpar-t Jun 28, 2018
ef58e75
fix painles array tets
alpar-t Jun 28, 2018
b744d1e
Update jar checksums
alpar-t Jun 28, 2018
ba87083
Keep 8/10 runtime/compile untill consensus builds on 11
alpar-t Jun 29, 2018
fb05672
Only skip failing tests if running on Java 11
alpar-t Jul 2, 2018
cfc5923
Failures are dependent of compile java version not runtime
alpar-t Jul 2, 2018
9961d8e
Merge remote-tracking branch 'origin/master' into feature/jdk11-31230
alpar-t Jul 2, 2018
e6720b8
Condition doc test exceptions on compiler java version as well
alpar-t Jul 2, 2018
41d97c1
Disable hdfs tests based on runtime java
alpar-t Jul 2, 2018
188460a
Set runtime java to minimum supported for bwc
alpar-t Jul 2, 2018
6d9fb3f
PR review
alpar-t Jul 3, 2018
13f536b
Add comment with ticket for forbidden apis
alpar-t Jul 4, 2018
062561c
Merge commit 'e9f8442' into feature/jdk11-31230
alpar-t Jul 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/matrix-build-javas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

ES_BUILD_JAVA:
- java10
- java11
1 change: 1 addition & 0 deletions .ci/matrix-runtime-javas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
ES_RUNTIME_JAVA:
- java8
- java10
- java11
1 change: 0 additions & 1 deletion buildSrc/src/main/resources/forbidden/jdk-signatures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ java.lang.Thread#getAllStackTraces()

@defaultMessage Stopping threads explicitly leads to inconsistent states. Use interrupt() instead.
java.lang.Thread#stop()
java.lang.Thread#stop(java.lang.Throwable)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed from forbidden apis? The forbidden signatures should against our minimum runtime, which is still java 8.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method was removed in jdk 11 and causing the test to fail.
Do we have per JDK version forbidden APIs ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not. I think this is related to running forbidden apis in a separate jvm. We should always be running it with the minimum supported version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please comment this out and reference the issue to run forbidden apis in a forked jvm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, will remove comment once #31715 is fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this issue was the only reason to no longer use the gradle plugin and fork instead, I can just say: The above forbidden-api signature can be removed anyways from elasticsearch (together with the previous one). Forbiddenapis has those signatures already in its "jdk-deprecated" ones, as it's a known problem - so there is no need to have it in Elasticsearch's custom signatures. "jdk-deprecated" automatically handles deprecations that were removed.

IMHO, #31715 was not a good idea, sorry!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


@defaultMessage Please do not terminate the application
java.lang.System#exit(int)
Expand Down
36 changes: 34 additions & 2 deletions distribution/bwc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
*/



import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.Version

import static org.elasticsearch.gradle.BuildPlugin.getJavaHome
import java.nio.charset.StandardCharsets

import static org.elasticsearch.gradle.BuildPlugin.getJavaHome
/**
* This is a dummy project which does a local checkout of the previous
* wire compat version's branch, and builds a snapshot. This allows backcompat
Expand Down Expand Up @@ -147,12 +149,16 @@ subprojects {

task buildBwcVersion(type: Exec) {
dependsOn checkoutBwcBranch, writeBuildMetadata
// send RUNTIME_JAVA_HOME so the build doesn't fails on newer version the branch doesn't know about
environment('RUNTIME_JAVA_HOME', getJavaHome(it, rootProject.ext.minimumRuntimeVersion.getMajorVersion() as int))
workingDir = checkoutDir
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
if (["5.6", "6.0", "6.1"].contains(bwcBranch)) {
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
environment('JAVA_HOME', getJavaHome(it, 8))
} else if ("6.2".equals(bwcBranch)) {
environment('JAVA_HOME', getJavaHome(it, 9))
} else if (["6.3", "6.x"].contains(bwcBranch)) {
environment('JAVA_HOME', getJavaHome(it, 10))
} else {
environment('JAVA_HOME', project.compilerJavaHome)
}
Expand All @@ -177,6 +183,8 @@ subprojects {
} else if (showStacktraceName.equals("ALWAYS_FULL")) {
args "--full-stacktrace"
}
standardOutput = new IndentingOutputStream(System.out)
errorOutput = new IndentingOutputStream(System.err)
doLast {
List missing = artifactFiles.grep { file ->
false == file.exists()
Expand All @@ -196,3 +204,27 @@ subprojects {
}
}
}

class IndentingOutputStream extends OutputStream {

public static final byte[] INDENT = " [bwc] ".getBytes(StandardCharsets.UTF_8)
private final OutputStream delegate

public IndentingOutputStream(OutputStream delegate) {
this.delegate = delegate
}

@Override
public void write(int b) {
write([b] as int[], 0, 1)
}

public void write(int[] bytes, int offset, int length) {
for (int i = 0; i < bytes.length; i++) {
delegate.write(bytes[i])
if (bytes[i] == '\n') {
delegate.write(INDENT)
}
}
}
}
9 changes: 9 additions & 0 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ integTestCluster {
setting 'reindex.remote.whitelist', '127.0.0.1:*'
}

// remove when https://github.com/elastic/elasticsearch/issues/31305 is fixed
if (rootProject.ext.compilerJavaVersion.isJava11()) {
integTestRunner {
systemProperty 'tests.rest.blacklist', [
'plugins/ingest-attachment/line_164',
'plugins/ingest-attachment/line_117'
].join(',')
}
}
// Build the cluster with all plugins

project.rootProject.subprojects.findAll { it.parent.path == ':plugins' }.each { subproj ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.elasticsearch.painless;

import org.apache.lucene.util.Constants;
import org.elasticsearch.bootstrap.JavaVersion;
import org.hamcrest.Matcher;

import java.lang.invoke.MethodHandle;
Expand All @@ -41,7 +42,11 @@ protected String valueCtorCall(String valueType, int size) {

@Override
protected Matcher<String> outOfBoundsExceptionMessageMatcher(int index, int size) {
return equalTo(Integer.toString(index));
if (JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0) {
return equalTo(Integer.toString(index));
} else{
return equalTo("Index " + Integer.toString(index) + " out of bounds for length " + Integer.toString(size));
}
}

public void testArrayLengthHelper() throws Throwable {
Expand Down
12 changes: 11 additions & 1 deletion plugins/ingest-attachment/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ esplugin {
versions << [
'tika': '1.18',
'pdfbox': '2.0.9',
'bouncycastle': '1.55',
'bouncycastle': '1.59',
'poi': '3.17',
'mime4j': '0.8.1'
]

if (rootProject.ext.compilerJavaVersion.isJava11()) {
// disabled until https://github.com/elastic/elasticsearch/issues/31456 is fixed.
integTestRunner {
systemProperty 'tests.rest.blacklist', [
'ingest_attachment/20_attachment_processor/Test indexed chars are configurable',
'ingest_attachment/20_attachment_processor/Test indexed chars are configurable per document'
].join(',')
}
}

dependencies {
// mandatory for tika
compile "org.apache.tika:tika-core:${versions.tika}"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
db389ade95f48592908a84e7050a691c8834723c

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9cef0aab8a4bb849a8476c058ce3ff302aba3fff

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2507204241ab450456bdb8e8c0a8f986e418bd99
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,11 @@ static PermissionCollection getRestrictedPermissions() {
perms.add(new RuntimePermission("getClassLoader"));
// ZipFile needs accessDeclaredMembers on JDK 10; cf. https://bugs.openjdk.java.net/browse/JDK-8187485
if (JavaVersion.current().compareTo(JavaVersion.parse("10")) >= 0) {
/*
* See if this permission can be removed in JDK 11, bump the version here to 12 if not. If this permission can be removed, also
* remove the grant in the plugin-security.policy.
*/
assert JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0;
perms.add(new RuntimePermission("accessDeclaredMembers"));
if (JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0) {
// TODO remove this and from plugin-security.policy when JDK 11 is the only one we support
// this is needed pre 11, but it's fixed in 11 : https://bugs.openjdk.java.net/browse/JDK-8187485
perms.add(new RuntimePermission("accessDeclaredMembers"));
}
}
perms.setReadOnly();
return perms;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.apache.commons.io.IOUtils;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.bootstrap.JavaVersion;
import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.Processor;
import org.elasticsearch.ingest.RandomDocumentPicks;
Expand Down Expand Up @@ -296,6 +297,7 @@ private Map<String, Object> parseDocument(String file, AttachmentProcessor proce
}

public void testIndexedChars() throws Exception {
assumeFalse("https://github.com/elastic/elasticsearch/issues/31305", JavaVersion.current().equals(JavaVersion.parse("11")));
processor = new AttachmentProcessor(randomAlphaOfLength(10), "source_field",
"target_field", EnumSet.allOf(AttachmentProcessor.Property.class), 19, false, null);

Expand Down
21 changes: 20 additions & 1 deletion plugins/repository-hdfs/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
1/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
Expand Down Expand Up @@ -214,6 +214,25 @@ RestIntegTestTask integTestSecureHa = project.tasks.create('integTestSecureHa',
description = "Runs rest tests against an elasticsearch cluster with HDFS configured with HA Namenode and secured by MIT Kerberos."
}

if (rootProject.ext.compilerJavaVersion.isJava11()) {
// TODO remove when: https://github.com/elastic/elasticsearch/issues/31498
integTestRunner {
systemProperty 'tests.rest.blacklist', [
'hdfs_repository/30_snapshot/take snapshot',
'hdfs_repository/40_restore/Create a snapshot and then restore it',
'hdfs_repository/20_repository_verify/HDFS Repository Verify',
'hdfs_repository/30_snapshot_get/Get a snapshot',
'hdfs_repository/20_repository_create/HDFS Repository Creation',
'hdfs_repository/20_repository_delete/HDFS Delete Repository',
'hdfs_repository/30_snapshot_readonly/Get a snapshot - readonly',
].join(',')
}
}
if (rootProject.ext.runtimeJavaVersion.isJava11()) {
// TODO remove when: https://github.com/elastic/elasticsearch/issues/31498
integTestHa.enabled = false
}

// Determine HDFS Fixture compatibility for the current build environment.
boolean fixtureSupported = false
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@
*/
package org.elasticsearch.repositories.hdfs;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;

import java.util.Collection;

import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
import org.elasticsearch.bootstrap.JavaVersion;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.settings.Settings;
Expand All @@ -35,6 +31,11 @@
import org.elasticsearch.snapshots.SnapshotState;
import org.elasticsearch.test.ESSingleNodeTestCase;

import java.util.Collection;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;

@ThreadLeakFilters(filters = {HdfsClientThreadLeakFilter.class})
public class HdfsTests extends ESSingleNodeTestCase {

Expand All @@ -44,6 +45,7 @@ protected Collection<Class<? extends Plugin>> getPlugins() {
}

public void testSimpleWorkflow() {
assumeFalse("https://github.com/elastic/elasticsearch/issues/31498", JavaVersion.current().equals(JavaVersion.parse("11")));
Client client = client();

PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugin/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ dependencies {

// security deps
compile 'com.unboundid:unboundid-ldapsdk:3.2.0'
compile 'org.bouncycastle:bcprov-jdk15on:1.58'
compile 'org.bouncycastle:bcpkix-jdk15on:1.58'
compile 'org.bouncycastle:bcprov-jdk15on:1.59'
compile 'org.bouncycastle:bcpkix-jdk15on:1.59'
compile project(path: ':modules:transport-netty4', configuration: 'runtime')

testCompile 'org.elasticsearch:securemock:1.2'
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugin/core/licenses/bcpkix-jdk15on-1.58.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/plugin/core/licenses/bcpkix-jdk15on-1.59.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9cef0aab8a4bb849a8476c058ce3ff302aba3fff
1 change: 0 additions & 1 deletion x-pack/plugin/core/licenses/bcprov-jdk15on-1.58.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/plugin/core/licenses/bcprov-jdk15on-1.59.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2507204241ab450456bdb8e8c0a8f986e418bd99
4 changes: 2 additions & 2 deletions x-pack/plugin/security/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ dependencies {
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')

compile 'com.unboundid:unboundid-ldapsdk:3.2.0'
compile 'org.bouncycastle:bcprov-jdk15on:1.58'
compile 'org.bouncycastle:bcpkix-jdk15on:1.58'
compile 'org.bouncycastle:bcprov-jdk15on:1.59'
compile 'org.bouncycastle:bcpkix-jdk15on:1.59'

// the following are all SAML dependencies - might as well download the whole internet
compile "org.opensaml:opensaml-core:3.3.0"
Expand Down