Skip to content

Commit 07bd9d8

Browse files
committed
Merge remote-tracking branch 'elastic/master' into system-jvm-options
* elastic/master: [Docs] Fix opType options in IndexRequest API example. (elastic#48290) Simplify Shard Snapshot Upload Code (elastic#48155) Mute ClassificationIT tests (elastic#48338) Reenable azure repository tests and remove some randomization in http servers (elastic#48283) Use an env var for the classpath of jar hell task (elastic#48240) Refactor FIPS BootstrapChecks to simple checks (elastic#47499) Add "format" to "range" queries resulted from optimizing a logical AND (elastic#48073) [DOCS][Transform] document limitation regarding rolling upgrade with 7.2, 7.3 (elastic#48118) Fail with a better error when if there are no ingest nodes (elastic#48272) Fix executing enrich policies stats (elastic#48132) Use MultiFileTransfer in CCR remote recovery (elastic#44514) Make BytesReference an interface (elastic#48171) Also validate source index at put enrich policy time. (elastic#48254) Add 'javadoc' task to lifecycle check tasks (elastic#48214) Remove option to enable direct buffer pooling (elastic#47956) [DOCS] Add 'Selecting gateway and seed nodes' section to CCS docs (elastic#48297) Add Enrich Origin (elastic#48098) fix incorrect comparison (elastic#48208)
2 parents eb67200 + ef240d8 commit 07bd9d8

File tree

90 files changed

+1461
-1053
lines changed

Some content is hidden

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

90 files changed

+1461
-1053
lines changed

buildSrc/reaper/src/main/java/org/elasticsearch/gradle/reaper/Reaper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Since how to reap a given service is platform and service dependent, this tool
3838
* operates on system commands to execute. It takes a single argument, a directory
3939
* that will contain files with reaping commands. Each line in each file will be
40-
* executed with {@link Runtime#getRuntime()#exec}.
40+
* executed with {@link Runtime#exec(String)}.
4141
*
4242
* The main method will wait indefinitely on the parent process (Gradle) by
4343
* reading from stdin. When Gradle shuts down, whether normally or abruptly, the

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,10 @@ class BuildPlugin implements Plugin<Project> {
676676
*/
677677
(javadoc.options as CoreJavadocOptions).addBooleanOption('html5', true)
678678
}
679+
// ensure javadoc task is run with 'check'
680+
project.pluginManager.withPlugin('lifecycle-base') {
681+
project.tasks.getByName(LifecycleBasePlugin.CHECK_TASK_NAME).dependsOn(project.tasks.withType(Javadoc))
682+
}
679683
configureJavadocJar(project)
680684
}
681685

@@ -889,7 +893,6 @@ class BuildPlugin implements Plugin<Project> {
889893
test.systemProperty('io.netty.noUnsafe', 'true')
890894
test.systemProperty('io.netty.noKeySetOptimization', 'true')
891895
test.systemProperty('io.netty.recycler.maxCapacityPerThread', '0')
892-
test.systemProperty('io.netty.allocator.numDirectArenas', '0')
893896

894897
test.testLogging { TestLoggingContainer logging ->
895898
logging.showExceptions = true

buildSrc/src/main/java/org/elasticsearch/gradle/precommit/JarHellTask.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public JarHellTask() {
4242
@TaskAction
4343
public void runJarHellCheck() {
4444
LoggedExec.javaexec(getProject(), spec -> {
45-
spec.classpath(getClasspath());
45+
spec.environment("CLASSPATH", getClasspath().getAsPath());
4646
spec.setMain("org.elasticsearch.bootstrap.JarHell");
4747
});
4848
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public boolean equals(Object obj) {
133133
&& Objects.equals(id, other.id)
134134
&& docVersion == other.docVersion
135135
&& found == other.found
136-
&& tookInMillis == tookInMillis
136+
&& tookInMillis == other.tookInMillis
137137
&& Objects.equals(termVectorList, other.termVectorList);
138138
}
139139

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import org.elasticsearch.common.ParseField;
2222
import org.elasticsearch.common.ParsingException;
23-
import org.elasticsearch.common.bytes.BytesArray;
2423
import org.elasticsearch.common.bytes.BytesReference;
2524
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
2625
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -60,7 +59,7 @@ private static void declareParserOptions(ConstructingObjectParser<?, ?> parser)
6059
parser.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> {
6160
XContentBuilder builder = XContentBuilder.builder(p.contentType().xContent());
6261
builder.copyCurrentStructure(p);
63-
return BytesArray.bytes(builder);
62+
return BytesReference.bytes(builder);
6463
}, QUERY_FIELD);
6564
parser.declareStringArray(ConstructingObjectParser.constructorArg(), INDICES_FIELD);
6665
parser.declareString(ConstructingObjectParser.constructorArg(), MATCH_FIELD_FIELD);

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import org.elasticsearch.common.ParseField;
2323
import org.elasticsearch.common.Strings;
24-
import org.elasticsearch.common.bytes.BytesArray;
2524
import org.elasticsearch.common.bytes.BytesReference;
2625
import org.elasticsearch.common.unit.TimeValue;
2726
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
@@ -86,7 +85,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject {
8685
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> {
8786
XContentBuilder builder = JsonXContent.contentBuilder();
8887
builder.copyCurrentStructure(p);
89-
return BytesArray.bytes(builder);
88+
return BytesReference.bytes(builder);
9089
}, STEP_INFO_FIELD);
9190
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> PhaseExecutionInfo.parse(p, ""),
9291
PHASE_EXECUTION_INFO);

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

+12
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public void cleanup() {
5858

5959
public void testPutPolicy() throws Exception {
6060
RestHighLevelClient client = highLevelClient();
61+
CreateIndexRequest createIndexRequest = new CreateIndexRequest("users")
62+
.mapping(Map.of("properties", Map.of("email", Map.of("type", "keyword"))));
63+
client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
64+
6165
// tag::enrich-put-policy-request
6266
PutPolicyRequest putPolicyRequest = new PutPolicyRequest(
6367
"users-policy", "match", List.of("users"),
@@ -104,6 +108,10 @@ public void testDeletePolicy() throws Exception {
104108
RestHighLevelClient client = highLevelClient();
105109

106110
{
111+
CreateIndexRequest createIndexRequest = new CreateIndexRequest("users")
112+
.mapping(Map.of("properties", Map.of("email", Map.of("type", "keyword"))));
113+
client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
114+
107115
// Add a policy, so that it can be deleted:
108116
PutPolicyRequest putPolicyRequest = new PutPolicyRequest(
109117
"users-policy", "match", List.of("users"),
@@ -155,6 +163,10 @@ public void onFailure(Exception e) {
155163
public void testGetPolicy() throws Exception {
156164
RestHighLevelClient client = highLevelClient();
157165

166+
CreateIndexRequest createIndexRequest = new CreateIndexRequest("users")
167+
.mapping(Map.of("properties", Map.of("email", Map.of("type", "keyword"))));
168+
client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
169+
158170
PutPolicyRequest putPolicyRequest = new PutPolicyRequest(
159171
"users-policy", "match", List.of("users"),
160172
"email", List.of("address", "zip", "city", "state"));

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.elasticsearch.client.enrich;
2020

2121
import org.elasticsearch.client.AbstractResponseTestCase;
22-
import org.elasticsearch.common.bytes.BytesArray;
2322
import org.elasticsearch.common.bytes.BytesReference;
2423
import org.elasticsearch.common.xcontent.XContentBuilder;
2524
import org.elasticsearch.common.xcontent.XContentParser;
@@ -80,7 +79,7 @@ private static EnrichPolicy createRandomEnrichPolicy(XContentType xContentType){
8079
try (XContentBuilder builder = XContentBuilder.builder(xContentType.xContent())) {
8180
builder.startObject();
8281
builder.endObject();
83-
BytesReference querySource = BytesArray.bytes(builder);
82+
BytesReference querySource = BytesReference.bytes(builder);
8483
return new EnrichPolicy(
8584
randomAlphaOfLength(4),
8685
randomBoolean() ? new EnrichPolicy.QuerySource(querySource, xContentType) : null,

distribution/tools/launchers/src/main/java/org/elasticsearch/tools/launchers/JvmErgonomics.java

-8
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ static List<String> choose(final List<String> userDefinedJvmOptions) throws Inte
5555
final List<String> ergonomicChoices = new ArrayList<>();
5656
final Map<String, Optional<String>> finalJvmOptions = finalJvmOptions(userDefinedJvmOptions);
5757
final long heapSize = extractHeapSize(finalJvmOptions);
58-
final Map<String, String> systemProperties = extractSystemProperties(userDefinedJvmOptions);
59-
if (systemProperties.containsKey("io.netty.allocator.type") == false) {
60-
if (heapSize <= 1 << 30) {
61-
ergonomicChoices.add("-Dio.netty.allocator.type=unpooled");
62-
} else {
63-
ergonomicChoices.add("-Dio.netty.allocator.type=pooled");
64-
}
65-
}
6658
final long maxDirectMemorySize = extractMaxDirectMemorySize(finalJvmOptions);
6759
if (maxDirectMemorySize == 0) {
6860
ergonomicChoices.add("-XX:MaxDirectMemorySize=" + heapSize / 2);

distribution/tools/launchers/src/test/java/org/elasticsearch/tools/launchers/JvmErgonomicsTests.java

-14
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,6 @@ public void testExtractNoSystemProperties() {
117117
assertTrue(parsedSystemProperties.isEmpty());
118118
}
119119

120-
public void testPooledMemoryChoiceOnSmallHeap() throws InterruptedException, IOException {
121-
final String smallHeap = randomFrom(Arrays.asList("64M", "512M", "1024M", "1G"));
122-
assertThat(
123-
JvmErgonomics.choose(Arrays.asList("-Xms" + smallHeap, "-Xmx" + smallHeap)),
124-
hasItem("-Dio.netty.allocator.type=unpooled"));
125-
}
126-
127-
public void testPooledMemoryChoiceOnNotSmallHeap() throws InterruptedException, IOException {
128-
final String largeHeap = randomFrom(Arrays.asList("1025M", "2048M", "2G", "8G"));
129-
assertThat(
130-
JvmErgonomics.choose(Arrays.asList("-Xms" + largeHeap, "-Xmx" + largeHeap)),
131-
hasItem("-Dio.netty.allocator.type=pooled"));
132-
}
133-
134120
public void testMaxDirectMemorySizeChoice() throws InterruptedException, IOException {
135121
final Map<String, String> heapMaxDirectMemorySize = Map.of(
136122
"64M", Long.toString((64L << 20) / 2),

docs/java-rest/high-level/document/index.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ include-tagged::{doc-tests-file}[{api}-request-version-type]
8585
include-tagged::{doc-tests-file}[{api}-request-op-type]
8686
--------------------------------------------------
8787
<1> Operation type provided as an `DocWriteRequest.OpType` value
88-
<2> Operation type provided as a `String`: can be `create` or `update` (default)
88+
<2> Operation type provided as a `String`: can be `create` or `index` (default)
8989

9090
["source","java",subs="attributes,callouts,macros"]
9191
--------------------------------------------------

docs/reference/ingest/apis/enrich/delete-enrich-policy.asciidoc

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ Deletes an existing enrich policy and its enrich index.
1212
[source,console]
1313
----
1414
PUT /users
15+
{
16+
"mappings" : {
17+
"properties" : {
18+
"email" : { "type" : "keyword" }
19+
}
20+
}
21+
}
1522
1623
PUT /_enrich/policy/my-policy
1724
{

docs/reference/ingest/apis/enrich/get-enrich-policy.asciidoc

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ Returns information about an enrich policy.
1212
[source,console]
1313
----
1414
PUT /users
15+
{
16+
"mappings" : {
17+
"properties" : {
18+
"email" : { "type" : "keyword" }
19+
}
20+
}
21+
}
1522
1623
PUT /_enrich/policy/my-policy
1724
{

docs/reference/ingest/apis/enrich/put-enrich-policy.asciidoc

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ Creates an enrich policy.
1212
[source,console]
1313
----
1414
PUT /users
15+
{
16+
"mappings" : {
17+
"properties" : {
18+
"email" : { "type" : "keyword" }
19+
}
20+
}
21+
}
1522
----
1623
////
1724

docs/reference/modules/cross-cluster-search.asciidoc

+25-5
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,31 @@ PUT _cluster/settings
242242
If `cluster_two` is disconnected or unavailable during a {ccs}, {es} won't
243243
include matching documents from that cluster in the final results.
244244

245-
[float]
245+
[discrete]
246246
[[ccs-works]]
247247
== How {ccs} works
248+
249+
include::./remote-clusters.asciidoc[tag=how-remote-clusters-work]
250+
251+
[discrete]
252+
[[ccs-gateway-seed-nodes]]
253+
=== Selecting gateway and seed nodes
254+
255+
Gateway and seed nodes need to be accessible from the local cluster via your
256+
network.
257+
258+
By default, any master-ineligible node can act as a gateway node. If wanted,
259+
you can define the gateway nodes for a cluster by setting
260+
`cluster.remote.node.attr.gateway` to `true`.
261+
262+
For {ccs}, we recommend you use gateway nodes that are capable of serving as
263+
<<coordinating-node,coordinating nodes>> for search requests. If
264+
wanted, the seed nodes for a cluster can be a subset of these gateway nodes.
265+
266+
[discrete]
267+
[[ccs-network-delays]]
268+
=== How {ccs} handles network delays
269+
248270
Because {ccs} involves sending requests to remote clusters, any network delays
249271
can impact search speed. To avoid slow searches, {ccs} offers two options for
250272
handling network delays:
@@ -268,11 +290,9 @@ latency.
268290
+
269291
See <<ccs-unmin-roundtrips>> to learn how this option works.
270292

271-
272-
273293
[float]
274294
[[ccs-min-roundtrips]]
275-
=== Minimize network roundtrips
295+
==== Minimize network roundtrips
276296

277297
Here's how {ccs} works when you minimize network roundtrips.
278298

@@ -297,7 +317,7 @@ image:images/ccs/ccs-min-roundtrip-client-response.png[]
297317

298318
[float]
299319
[[ccs-unmin-roundtrips]]
300-
=== Don't minimize network roundtrips
320+
==== Don't minimize network roundtrips
301321

302322
Here's how {ccs} works when you don't minimize network roundtrips.
303323

docs/reference/modules/remote-clusters.asciidoc

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ connections to a remote cluster. This functionality is used in
1313
<<modules-cross-cluster-search,{ccs}>>.
1414
endif::[]
1515

16+
// tag::how-remote-clusters-work[]
1617
Remote cluster connections work by configuring a remote cluster and connecting
1718
only to a limited number of nodes in that remote cluster. Each remote cluster
1819
is referenced by a name and a list of seed nodes. When a remote cluster is
1920
registered, its cluster state is retrieved from one of the seed nodes and up
2021
to three _gateway nodes_ are selected to be connected to as part of remote
21-
cluster requests. All the communication required between different clusters
22+
cluster requests.
23+
// end::how-remote-clusters-work[]
24+
25+
All the communication required between different clusters
2226
goes through the <<modules-transport,transport layer>>. Remote cluster
2327
connections consist of uni-directional connections from the coordinating
2428
node to the selected remote _gateway nodes_ only.

docs/reference/transform/limitations.asciidoc

+11-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ upgrade from 7.2 to a newer version, and {transforms} have been created in 7.2,
3333
the {transforms} UI (earler {dataframe} UI) will not work. Please wait until all
3434
nodes have been upgraded to the newer version before using the {transforms} UI.
3535

36+
[float]
37+
[[transform-rolling-upgrade-limitation]]
38+
==== {transforms-cap} reassignment suspended during a rolling upgrade from 7.2 and 7.3
39+
40+
If your cluster contains mixed version nodes, for example during a rolling
41+
upgrade from 7.2 or 7.3 to a newer version, {transforms} whose nodes are stopped will
42+
not be reassigned until the upgrade is complete. After the upgrade is done, {transforms}
43+
resume automatically; no action is required.
3644

3745
[float]
3846
[[transform-datatype-limitations]]
@@ -181,9 +189,9 @@ for the {transform} checkpoint to complete.
181189

182190
[float]
183191
[[transform-scheduling-limitations]]
184-
==== {cdataframe-cap} scheduling limitations
192+
==== {ctransform-cap} scheduling limitations
185193

186-
A {cdataframe} periodically checks for changes to source data. The functionality
194+
A {ctransform} periodically checks for changes to source data. The functionality
187195
of the scheduler is currently limited to a basic periodic timer which can be
188196
within the `frequency` range from 1s to 1h. The default is 1m. This is designed
189197
to run little and often. When choosing a `frequency` for this timer consider
@@ -206,7 +214,7 @@ When using the API to delete a failed {transform}, first stop it using
206214

207215
[float]
208216
[[transform-availability-limitations]]
209-
==== {cdataframes-cap} may give incorrect results if documents are not yet available to search
217+
==== {ctransforms-cap} may give incorrect results if documents are not yet available to search
210218

211219
After a document is indexed, there is a very small delay until it is available
212220
to search.

modules/transport-netty4/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ integTestRunner {
6666
TaskProvider<Test> pooledTest = tasks.register("pooledTest", Test) {
6767
include '**/*Tests.class'
6868
systemProperty 'es.set.netty.runtime.available.processors', 'false'
69-
systemProperty 'io.netty.allocator.type', 'pooled'
69+
systemProperty 'es.use_unpooled_allocator', 'false'
7070
}
7171
// TODO: we can't use task avoidance here because RestIntegTestTask does the testcluster creation
7272
RestIntegTestTask pooledIntegTest = tasks.create("pooledIntegTest", RestIntegTestTask) {
@@ -75,7 +75,7 @@ RestIntegTestTask pooledIntegTest = tasks.create("pooledIntegTest", RestIntegTes
7575
}
7676
}
7777
testClusters.pooledIntegTest {
78-
systemProperty 'io.netty.allocator.type', 'pooled'
78+
systemProperty 'es.use_unpooled_allocator', 'false'
7979
}
8080
check.dependsOn(pooledTest, pooledIntegTest)
8181

modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java

+7-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
package org.elasticsearch.http.netty4;
2121

2222
import io.netty.bootstrap.ServerBootstrap;
23-
import io.netty.buffer.ByteBufAllocator;
2423
import io.netty.channel.Channel;
2524
import io.netty.channel.ChannelFuture;
2625
import io.netty.channel.ChannelHandler;
@@ -32,7 +31,6 @@
3231
import io.netty.channel.RecvByteBufAllocator;
3332
import io.netty.channel.nio.NioEventLoopGroup;
3433
import io.netty.channel.socket.nio.NioChannelOption;
35-
import io.netty.channel.socket.nio.NioServerSocketChannel;
3634
import io.netty.handler.codec.ByteToMessageDecoder;
3735
import io.netty.handler.codec.http.HttpContentCompressor;
3836
import io.netty.handler.codec.http.HttpContentDecompressor;
@@ -63,7 +61,7 @@
6361
import org.elasticsearch.http.HttpServerChannel;
6462
import org.elasticsearch.http.netty4.cors.Netty4CorsHandler;
6563
import org.elasticsearch.threadpool.ThreadPool;
66-
import org.elasticsearch.transport.CopyBytesServerSocketChannel;
64+
import org.elasticsearch.transport.NettyAllocator;
6765
import org.elasticsearch.transport.netty4.Netty4Utils;
6866

6967
import java.net.InetSocketAddress;
@@ -186,14 +184,12 @@ protected void doStart() {
186184
serverBootstrap.group(new NioEventLoopGroup(workerCount, daemonThreadFactory(settings,
187185
HTTP_SERVER_WORKER_THREAD_NAME_PREFIX)));
188186

189-
// If direct buffer pooling is disabled, use the CopyBytesServerSocketChannel which will create child
190-
// channels of type CopyBytesSocketChannel. CopyBytesSocketChannel pool a single direct buffer
191-
// per-event-loop thread to be used for IO operations.
192-
if (ByteBufAllocator.DEFAULT.isDirectBufferPooled()) {
193-
serverBootstrap.channel(NioServerSocketChannel.class);
194-
} else {
195-
serverBootstrap.channel(CopyBytesServerSocketChannel.class);
196-
}
187+
// NettyAllocator will return the channel type designed to work with the configuredAllocator
188+
serverBootstrap.channel(NettyAllocator.getServerChannelType());
189+
190+
// Set the allocators for both the server channel and the child channels created
191+
serverBootstrap.option(ChannelOption.ALLOCATOR, NettyAllocator.getAllocator());
192+
serverBootstrap.childOption(ChannelOption.ALLOCATOR, NettyAllocator.getAllocator());
197193

198194
serverBootstrap.childHandler(configureServerChannelHandler());
199195
serverBootstrap.handler(new ServerChannelExceptionHandler(this));

0 commit comments

Comments
 (0)