Skip to content

Commit c838141

Browse files
committed
Merge remote-tracking branch 'es/6.x' into ccr-6.x
* es/6.x: (89 commits) Clarify requirements of strict date formats. (#29090) Clarify that dates are always rendered as strings. (#29093) [Docs] Fix link to Grok patterns (#29088) Fix starting on Windows from another drive (#29086) Use removeTask instead of finishTask in PersistentTasksClusterService (#29055) Added minimal docs for reindex api in java-api docs Allow overriding JVM options in Windows service (#29044) Clarify how to set compiler and runtime JDKs (#29101) Fix Parsing Bug with Update By Query for Stored Scripts (#29039) TEST: write ops should execute under shard permit (#28966) [DOCS] Add X-Pack upgrade details (#29038) Revert "Improve error message for installing plugin (#28298)" Docs: HighLevelRestClient#exists (#29073) Validate regular expressions in dynamic templates. (#29013) [Tests] Fix GetResultTests and DocumentFieldTests failures (#29083) Reenable LiveVersionMapTests.testRamBytesUsed on Java 9. (#29063) Mute failing GetResultTests and DocumentFieldTests [Docs] Fix Java Api index administration usage (#28260) Improve error message for installing plugin (#28298) Decouple XContentBuilder from BytesReference (#28972) ...
2 parents 144882b + eb7b46b commit c838141

File tree

592 files changed

+8301
-5677
lines changed

Some content is hidden

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

592 files changed

+8301
-5677
lines changed

TESTING.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ The REST tests are run automatically when executing the "./gradlew check" comman
270270
REST tests use the following command:
271271

272272
---------------------------------------------------------------------------
273-
./gradlew :distribution:integ-test-zip:integTest \
273+
./gradlew :distribution:archives:integ-test-zip:integTest \
274274
-Dtests.class="org.elasticsearch.test.rest.*Yaml*IT"
275275
---------------------------------------------------------------------------
276276

277277
A specific test case can be run with
278278

279279
---------------------------------------------------------------------------
280-
./gradlew :distribution:integ-test-zip:integTest \
280+
./gradlew :distribution:archives:integ-test-zip:integTest \
281281
-Dtests.class="org.elasticsearch.test.rest.*Yaml*IT" \
282282
-Dtests.method="test {p0=cat.shards/10_basic/Help}"
283283
---------------------------------------------------------------------------
@@ -407,7 +407,7 @@ destructive. When working with a single package it's generally faster to run its
407407
tests in a tighter loop than Gradle provides. In one window:
408408

409409
--------------------------------
410-
./gradlew :distribution:rpm:assemble
410+
./gradlew :distribution:packages:rpm:assemble
411411
--------------------------------
412412

413413
and in another window:

benchmarks/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ shadowJar {
8585
classifier = 'benchmarks'
8686
}
8787

88+
runShadow {
89+
executable = new File(project.runtimeJavaHome, 'bin/java')
90+
}
91+
8892
// alias the shadowJar and runShadow tasks to abstract from the concrete plugin that we are using and provide a more consistent interface
8993
task jmhJar(
9094
dependsOn: shadowJar,

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,22 @@ class BuildPlugin implements Plugin<Project> {
140140

141141
final GradleVersion minGradle = GradleVersion.version('4.3')
142142
if (currentGradleVersion < minGradle) {
143-
throw new GradleException("${minGradle} or above is required to build elasticsearch")
143+
throw new GradleException("${minGradle} or above is required to build Elasticsearch")
144144
}
145145

146146
// enforce Java version
147147
if (compilerJavaVersionEnum < minimumCompilerVersion) {
148-
throw new GradleException("Java ${minimumCompilerVersion} or above is required to build Elasticsearch")
148+
final String message =
149+
"the environment variable JAVA_HOME must be set to a JDK installation directory for Java ${minimumCompilerVersion}" +
150+
" but is [${compilerJavaHome}] corresponding to [${compilerJavaVersionEnum}]"
151+
throw new GradleException(message)
149152
}
150153

151154
if (runtimeJavaVersionEnum < minimumRuntimeVersion) {
152-
throw new GradleException("Java ${minimumRuntimeVersion} or above is required to run Elasticsearch")
155+
final String message =
156+
"the environment variable RUNTIME_JAVA_HOME must be set to a JDK installation directory for Java ${minimumRuntimeVersion}" +
157+
" but is [${runtimeJavaHome}] corresponding to [${runtimeJavaVersionEnum}]"
158+
throw new GradleException(message)
153159
}
154160

155161
project.rootProject.ext.compilerJavaHome = compilerJavaHome
@@ -558,7 +564,7 @@ class BuildPlugin implements Plugin<Project> {
558564
return {
559565
jvm "${project.runtimeJavaHome}/bin/java"
560566
parallelism System.getProperty('tests.jvms', 'auto')
561-
ifNoTests 'fail'
567+
ifNoTests System.getProperty('tests.ifNoTests', 'fail')
562568
onNonEmptyWorkDirectory 'wipe'
563569
leaveTemporary true
564570

@@ -582,8 +588,6 @@ class BuildPlugin implements Plugin<Project> {
582588
systemProperty 'tests.task', path
583589
systemProperty 'tests.security.manager', 'true'
584590
systemProperty 'jna.nosys', 'true'
585-
// default test sysprop values
586-
systemProperty 'tests.ifNoTests', 'fail'
587591
// TODO: remove setting logging level via system property
588592
systemProperty 'tests.logger.level', 'WARN'
589593
for (Map.Entry<String, String> property : System.properties.entrySet()) {

buildSrc/src/main/resources/forbidden/es-all-signatures.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ java.nio.channels.SocketChannel#connect(java.net.SocketAddress)
4848
# org.elasticsearch.common.Booleans#parseBoolean(java.lang.String) directly on the string.
4949
@defaultMessage use org.elasticsearch.common.Booleans#parseBoolean(java.lang.String)
5050
java.lang.Boolean#getBoolean(java.lang.String)
51+
52+
org.apache.lucene.util.IOUtils @ use @org.elasticsearch.core.internal.io instead

buildSrc/src/main/resources/forbidden/es-server-signatures.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ java.util.concurrent.Executors#privilegedThreadFactory()
2929
java.lang.Character#codePointBefore(char[],int) @ Implicit start offset is error-prone when the char[] is a buffer and the first chars are random chars
3030
java.lang.Character#codePointAt(char[],int) @ Implicit end offset is error-prone when the char[] is a buffer and the last chars are random chars
3131

32-
java.io.StringReader#<init>(java.lang.String) @ Use FastStringReader instead
33-
3432
@defaultMessage Reference management is tricky, leave it to SearcherManager
3533
org.apache.lucene.index.IndexReader#decRef()
3634
org.apache.lucene.index.IndexReader#incRef()
@@ -135,3 +133,17 @@ java.time.OffsetDateTime#withYear(int)
135133
java.time.zone.ZoneRules#getStandardOffset(java.time.Instant)
136134
java.time.zone.ZoneRules#getDaylightSavings(java.time.Instant)
137135
java.time.zone.ZoneRules#isDaylightSavings(java.time.Instant)
136+
137+
@defaultMessage Use logger methods with non-Object parameter
138+
org.apache.logging.log4j.Logger#trace(java.lang.Object)
139+
org.apache.logging.log4j.Logger#trace(java.lang.Object, java.lang.Throwable)
140+
org.apache.logging.log4j.Logger#debug(java.lang.Object)
141+
org.apache.logging.log4j.Logger#debug(java.lang.Object, java.lang.Throwable)
142+
org.apache.logging.log4j.Logger#info(java.lang.Object)
143+
org.apache.logging.log4j.Logger#info(java.lang.Object, java.lang.Throwable)
144+
org.apache.logging.log4j.Logger#warn(java.lang.Object)
145+
org.apache.logging.log4j.Logger#warn(java.lang.Object, java.lang.Throwable)
146+
org.apache.logging.log4j.Logger#error(java.lang.Object)
147+
org.apache.logging.log4j.Logger#error(java.lang.Object, java.lang.Throwable)
148+
org.apache.logging.log4j.Logger#fatal(java.lang.Object)
149+
org.apache.logging.log4j.Logger#fatal(java.lang.Object, java.lang.Throwable)

buildSrc/src/main/resources/plugin-descriptor.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,3 @@ extended.plugins=${extendedPlugins}
4343
#
4444
# 'has.native.controller': whether or not the plugin has a native controller
4545
has.native.controller=${hasNativeController}
46-
#
47-
# 'requires.keystore': whether or not the plugin needs the elasticsearch keystore be created
48-
requires.keystore=${requiresKeystore}

client/rest-high-level/src/main/java/org/elasticsearch/client/Request.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static Request bulk(BulkRequest bulkRequest) throws IOException {
330330
}
331331
metadata.endObject();
332332

333-
BytesRef metadataSource = metadata.bytes().toBytesRef();
333+
BytesRef metadataSource = BytesReference.bytes(metadata).toBytesRef();
334334
content.write(metadataSource.bytes, metadataSource.offset, metadataSource.length);
335335
content.write(separator);
336336
}
@@ -345,7 +345,7 @@ static Request bulk(BulkRequest bulkRequest) throws IOException {
345345
LoggingDeprecationHandler.INSTANCE, indexSource, indexXContentType)) {
346346
try (XContentBuilder builder = XContentBuilder.builder(bulkContentType.xContent())) {
347347
builder.copyCurrentStructure(parser);
348-
source = builder.bytes().toBytesRef();
348+
source = BytesReference.bytes(builder).toBytesRef();
349349
}
350350
}
351351
} else if (opType == DocWriteRequest.OpType.UPDATE) {

client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,8 @@ public void testBulk() throws IOException {
617617
bulkRequest.add(deleteRequest);
618618

619619
} else {
620-
BytesReference source = XContentBuilder.builder(xContentType.xContent()).startObject().field("id", i).endObject().bytes();
620+
BytesReference source = BytesReference.bytes(XContentBuilder.builder(xContentType.xContent())
621+
.startObject().field("id", i).endObject());
621622
if (opType == DocWriteRequest.OpType.INDEX) {
622623
IndexRequest indexRequest = new IndexRequest("index", "test", id).source(source, xContentType);
623624
if (erroneous) {

client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import org.elasticsearch.action.search.ShardSearchFailure;
5656
import org.elasticsearch.cluster.ClusterName;
5757
import org.elasticsearch.common.CheckedFunction;
58+
import org.elasticsearch.common.bytes.BytesReference;
5859
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
5960
import org.elasticsearch.common.xcontent.ToXContent;
6061
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -272,7 +273,7 @@ private static HttpEntity createBinaryEntity(XContentBuilder xContentBuilder, Co
272273
builder.startObject();
273274
builder.field("field", "value");
274275
builder.endObject();
275-
return new ByteArrayEntity(builder.bytes().toBytesRef().bytes, contentType);
276+
return new ByteArrayEntity(BytesReference.bytes(builder).toBytesRef().bytes, contentType);
276277
}
277278
}
278279

client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.elasticsearch.action.search.SearchRequest;
3535
import org.elasticsearch.action.search.SearchResponse;
3636
import org.elasticsearch.action.search.SearchScrollRequest;
37+
import org.elasticsearch.common.Strings;
3738
import org.elasticsearch.common.unit.TimeValue;
3839
import org.elasticsearch.common.xcontent.XContentBuilder;
3940
import org.elasticsearch.index.query.MatchQueryBuilder;
@@ -478,7 +479,7 @@ public void testSearchScroll() throws Exception {
478479

479480
for (int i = 0; i < 100; i++) {
480481
XContentBuilder builder = jsonBuilder().startObject().field("field", i).endObject();
481-
HttpEntity entity = new NStringEntity(builder.string(), ContentType.APPLICATION_JSON);
482+
HttpEntity entity = new NStringEntity(Strings.toString(builder), ContentType.APPLICATION_JSON);
482483
client().performRequest(HttpPut.METHOD_NAME, "test/type1/" + Integer.toString(i), Collections.emptyMap(), entity);
483484
}
484485
client().performRequest(HttpPost.METHOD_NAME, "/test/_refresh");

0 commit comments

Comments
 (0)