Skip to content

Commit 77e69a3

Browse files
committed
Merge branch 'master' into security-app-privs
2 parents 4e1031b + d7785a7 commit 77e69a3

File tree

103 files changed

+2687
-1112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2687
-1112
lines changed

.ci/matrix-build-javas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77

88
ES_BUILD_JAVA:
99
- java10
10+
- java11

.ci/matrix-runtime-javas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
ES_RUNTIME_JAVA:
99
- java8
1010
- java10
11+
- java11

buildSrc/src/main/resources/forbidden/jdk-signatures.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ java.lang.Thread#getAllStackTraces()
8888

8989
@defaultMessage Stopping threads explicitly leads to inconsistent states. Use interrupt() instead.
9090
java.lang.Thread#stop()
91-
java.lang.Thread#stop(java.lang.Throwable)
91+
# uncomment when https://github.com/elastic/elasticsearch/issues/31715 is fixed
92+
# java.lang.Thread#stop(java.lang.Throwable)
9293

9394
@defaultMessage Please do not terminate the application
9495
java.lang.System#exit(int)

distribution/bwc/build.gradle

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
*/
1919

2020

21+
2122
import org.apache.tools.ant.taskdefs.condition.Os
2223
import org.elasticsearch.gradle.LoggedExec
2324
import org.elasticsearch.gradle.Version
2425

25-
import static org.elasticsearch.gradle.BuildPlugin.getJavaHome
26+
import java.nio.charset.StandardCharsets
2627

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

148150
task buildBwcVersion(type: Exec) {
149151
dependsOn checkoutBwcBranch, writeBuildMetadata
152+
// send RUNTIME_JAVA_HOME so the build doesn't fails on newer version the branch doesn't know about
153+
environment('RUNTIME_JAVA_HOME', getJavaHome(it, rootProject.ext.minimumRuntimeVersion.getMajorVersion() as int))
150154
workingDir = checkoutDir
155+
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
151156
if (["5.6", "6.0", "6.1"].contains(bwcBranch)) {
152-
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
153157
environment('JAVA_HOME', getJavaHome(it, 8))
154158
} else if ("6.2".equals(bwcBranch)) {
155159
environment('JAVA_HOME', getJavaHome(it, 9))
160+
} else if (["6.3", "6.x"].contains(bwcBranch)) {
161+
environment('JAVA_HOME', getJavaHome(it, 10))
156162
} else {
157163
environment('JAVA_HOME', project.compilerJavaHome)
158164
}
@@ -177,6 +183,8 @@ subprojects {
177183
} else if (showStacktraceName.equals("ALWAYS_FULL")) {
178184
args "--full-stacktrace"
179185
}
186+
standardOutput = new IndentingOutputStream(System.out)
187+
errorOutput = new IndentingOutputStream(System.err)
180188
doLast {
181189
List missing = artifactFiles.grep { file ->
182190
false == file.exists()
@@ -196,3 +204,27 @@ subprojects {
196204
}
197205
}
198206
}
207+
208+
class IndentingOutputStream extends OutputStream {
209+
210+
public static final byte[] INDENT = " [bwc] ".getBytes(StandardCharsets.UTF_8)
211+
private final OutputStream delegate
212+
213+
public IndentingOutputStream(OutputStream delegate) {
214+
this.delegate = delegate
215+
}
216+
217+
@Override
218+
public void write(int b) {
219+
write([b] as int[], 0, 1)
220+
}
221+
222+
public void write(int[] bytes, int offset, int length) {
223+
for (int i = 0; i < bytes.length; i++) {
224+
delegate.write(bytes[i])
225+
if (bytes[i] == '\n') {
226+
delegate.write(INDENT)
227+
}
228+
}
229+
}
230+
}

docs/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ integTestCluster {
3939
setting 'reindex.remote.whitelist', '127.0.0.1:*'
4040
}
4141

42+
// remove when https://github.com/elastic/elasticsearch/issues/31305 is fixed
43+
if (rootProject.ext.compilerJavaVersion.isJava11()) {
44+
integTestRunner {
45+
systemProperty 'tests.rest.blacklist', [
46+
'plugins/ingest-attachment/line_164',
47+
'plugins/ingest-attachment/line_117'
48+
].join(',')
49+
}
50+
}
4251
// Build the cluster with all plugins
4352

4453
project.rootProject.subprojects.findAll { it.parent.path == ':plugins' }.each { subproj ->

docs/reference/search/request/rescore.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ The query rescorer executes a second query only on the Top-K results
2929
returned by the <<search-request-query,`query`>> and
3030
<<search-request-post-filter,`post_filter`>> phases. The
3131
number of docs which will be examined on each shard can be controlled by
32-
the `window_size` parameter, which defaults to
33-
<<search-request-from-size,`from` and `size`>>.
32+
the `window_size` parameter, which defaults to 10.
3433

3534
By default the scores from the original query and the rescore query are
3635
combined linearly to produce the final `_score` for each document. The

modules/lang-painless/src/test/java/org/elasticsearch/painless/ArrayTests.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.elasticsearch.painless;
2121

2222
import org.apache.lucene.util.Constants;
23+
import org.elasticsearch.bootstrap.JavaVersion;
2324
import org.hamcrest.Matcher;
2425

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

4243
@Override
4344
protected Matcher<String> outOfBoundsExceptionMessageMatcher(int index, int size) {
44-
return equalTo(Integer.toString(index));
45+
if (JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0) {
46+
return equalTo(Integer.toString(index));
47+
} else{
48+
return equalTo("Index " + Integer.toString(index) + " out of bounds for length " + Integer.toString(size));
49+
}
4550
}
4651

4752
public void testArrayLengthHelper() throws Throwable {

modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4ScheduledPingTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void testScheduledPing() throws Exception {
8989
assertThat(nettyA.getPing().getFailedPings(), equalTo(0L));
9090
assertThat(nettyB.getPing().getFailedPings(), equalTo(0L));
9191

92-
serviceA.registerRequestHandler("sayHello", TransportRequest.Empty::new, ThreadPool.Names.GENERIC,
92+
serviceA.registerRequestHandler("internal:sayHello", TransportRequest.Empty::new, ThreadPool.Names.GENERIC,
9393
new TransportRequestHandler<TransportRequest.Empty>() {
9494
@Override
9595
public void messageReceived(TransportRequest.Empty request, TransportChannel channel, Task task) {
@@ -104,7 +104,7 @@ public void messageReceived(TransportRequest.Empty request, TransportChannel cha
104104

105105
int rounds = scaledRandomIntBetween(100, 5000);
106106
for (int i = 0; i < rounds; i++) {
107-
serviceB.submitRequest(nodeA, "sayHello",
107+
serviceB.submitRequest(nodeA, "internal:sayHello",
108108
TransportRequest.Empty.INSTANCE, TransportRequestOptions.builder().withCompress(randomBoolean()).build(),
109109
new TransportResponseHandler<TransportResponse.Empty>() {
110110
@Override

plugins/ingest-attachment/build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@ esplugin {
2525
versions << [
2626
'tika': '1.18',
2727
'pdfbox': '2.0.9',
28-
'bouncycastle': '1.55',
28+
'bouncycastle': '1.59',
2929
'poi': '3.17',
3030
'mime4j': '0.8.1'
3131
]
3232

33+
if (rootProject.ext.compilerJavaVersion.isJava11()) {
34+
// disabled until https://github.com/elastic/elasticsearch/issues/31456 is fixed.
35+
integTestRunner {
36+
systemProperty 'tests.rest.blacklist', [
37+
'ingest_attachment/20_attachment_processor/Test indexed chars are configurable',
38+
'ingest_attachment/20_attachment_processor/Test indexed chars are configurable per document'
39+
].join(',')
40+
}
41+
}
42+
3343
dependencies {
3444
// mandatory for tika
3545
compile "org.apache.tika:tika-core:${versions.tika}"

plugins/ingest-attachment/licenses/bcmail-jdk15on-1.55.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
db389ade95f48592908a84e7050a691c8834723c

plugins/ingest-attachment/licenses/bcpkix-jdk15on-1.55.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9cef0aab8a4bb849a8476c058ce3ff302aba3fff

plugins/ingest-attachment/licenses/bcprov-jdk15on-1.55.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2507204241ab450456bdb8e8c0a8f986e418bd99

plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/TikaImpl.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,11 @@ static PermissionCollection getRestrictedPermissions() {
164164
perms.add(new RuntimePermission("getClassLoader"));
165165
// ZipFile needs accessDeclaredMembers on JDK 10; cf. https://bugs.openjdk.java.net/browse/JDK-8187485
166166
if (JavaVersion.current().compareTo(JavaVersion.parse("10")) >= 0) {
167-
/*
168-
* 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
169-
* remove the grant in the plugin-security.policy.
170-
*/
171-
assert JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0;
172-
perms.add(new RuntimePermission("accessDeclaredMembers"));
167+
if (JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0) {
168+
// TODO remove this and from plugin-security.policy when JDK 11 is the only one we support
169+
// this is needed pre 11, but it's fixed in 11 : https://bugs.openjdk.java.net/browse/JDK-8187485
170+
perms.add(new RuntimePermission("accessDeclaredMembers"));
171+
}
173172
}
174173
perms.setReadOnly();
175174
return perms;

plugins/ingest-attachment/src/test/java/org/elasticsearch/ingest/attachment/AttachmentProcessorTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.apache.commons.io.IOUtils;
2323
import org.elasticsearch.ElasticsearchParseException;
24+
import org.elasticsearch.bootstrap.JavaVersion;
2425
import org.elasticsearch.ingest.IngestDocument;
2526
import org.elasticsearch.ingest.Processor;
2627
import org.elasticsearch.ingest.RandomDocumentPicks;
@@ -296,6 +297,7 @@ private Map<String, Object> parseDocument(String file, AttachmentProcessor proce
296297
}
297298

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

plugins/repository-hdfs/build.gradle

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
1/*
22
* Licensed to Elasticsearch under one or more contributor
33
* license agreements. See the NOTICE file distributed with
44
* this work for additional information regarding copyright
@@ -214,6 +214,25 @@ RestIntegTestTask integTestSecureHa = project.tasks.create('integTestSecureHa',
214214
description = "Runs rest tests against an elasticsearch cluster with HDFS configured with HA Namenode and secured by MIT Kerberos."
215215
}
216216

217+
if (rootProject.ext.compilerJavaVersion.isJava11()) {
218+
// TODO remove when: https://github.com/elastic/elasticsearch/issues/31498
219+
integTestRunner {
220+
systemProperty 'tests.rest.blacklist', [
221+
'hdfs_repository/30_snapshot/take snapshot',
222+
'hdfs_repository/40_restore/Create a snapshot and then restore it',
223+
'hdfs_repository/20_repository_verify/HDFS Repository Verify',
224+
'hdfs_repository/30_snapshot_get/Get a snapshot',
225+
'hdfs_repository/20_repository_create/HDFS Repository Creation',
226+
'hdfs_repository/20_repository_delete/HDFS Delete Repository',
227+
'hdfs_repository/30_snapshot_readonly/Get a snapshot - readonly',
228+
].join(',')
229+
}
230+
}
231+
if (rootProject.ext.runtimeJavaVersion.isJava11()) {
232+
// TODO remove when: https://github.com/elastic/elasticsearch/issues/31498
233+
integTestHa.enabled = false
234+
}
235+
217236
// Determine HDFS Fixture compatibility for the current build environment.
218237
boolean fixtureSupported = false
219238
if (Os.isFamily(Os.FAMILY_WINDOWS)) {

plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@
1818
*/
1919
package org.elasticsearch.repositories.hdfs;
2020

21-
import static org.hamcrest.Matchers.equalTo;
22-
import static org.hamcrest.Matchers.greaterThan;
23-
24-
import java.util.Collection;
25-
2621
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
2722
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
2823
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
2924
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
25+
import org.elasticsearch.bootstrap.JavaVersion;
3026
import org.elasticsearch.client.Client;
3127
import org.elasticsearch.cluster.ClusterState;
3228
import org.elasticsearch.common.settings.Settings;
@@ -35,6 +31,11 @@
3531
import org.elasticsearch.snapshots.SnapshotState;
3632
import org.elasticsearch.test.ESSingleNodeTestCase;
3733

34+
import java.util.Collection;
35+
36+
import static org.hamcrest.Matchers.equalTo;
37+
import static org.hamcrest.Matchers.greaterThan;
38+
3839
@ThreadLeakFilters(filters = {HdfsClientThreadLeakFilter.class})
3940
public class HdfsTests extends ESSingleNodeTestCase {
4041

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

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

4951
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")

0 commit comments

Comments
 (0)