Skip to content

Commit 7d3789c

Browse files
committed
Merge branch 'upstream/master' into tsdb-required-range-settings
* upstream/master: (55 commits) Fix ComposableIndexTemplate equals when composed_of is null (elastic#80864) Optimize DLS bitset building for matchAll query (elastic#81030) URL option for BaseRunAsSuperuserCommand (elastic#81025) Less Verbose Serialization of Snapshot Failure in SLM Metadata (elastic#80942) Fix shadowed vars pt7 (elastic#80996) Fail shards early when we can detect a type missmatch (elastic#79869) Delegate Ref Counting to ByteBuf in Netty Transport (elastic#81096) Clarify `unassigned.reason` docs (elastic#81017) Strip blocks from settings for reindex targets (elastic#80887) Split off the values supplier for ScriptDocValues (elastic#80635) [ML] Switch message and detail for model snapshot deprecations (elastic#81108) [DOCS] Update xrefs for snapshot restore docs (elastic#81023) [ML] Updates visiblity of validate API (elastic#81061) Track histogram of transport handling times (elastic#80581) [ML] Fix datafeed preview with remote indices (elastic#81099) [ML] Fix acceptable model snapshot versions in ML deprecation checker (elastic#81060) [ML] Add logging for failing PyTorch test (elastic#81044) Extending the timeout waiting for snapshot to be ready (elastic#81018) [ML] Fix incorrect logging of unexpected model size error (elastic#81089) [ML] Make inference timeout test more reliable (elastic#81094) ...
2 parents d025a4e + 2629c32 commit 7d3789c

File tree

344 files changed

+4867
-1893
lines changed

Some content is hidden

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

344 files changed

+4867
-1893
lines changed

build-conventions/src/main/java/org/elasticsearch/gradle/internal/checkstyle/HiddenFieldCheck.java

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,15 @@ public class HiddenFieldCheck extends AbstractCheck {
7171
/** Control whether to ignore constructor parameters. */
7272
private boolean ignoreConstructorParameter;
7373

74+
/** Control whether to ignore variables in constructor bodies. */
75+
private boolean ignoreConstructorBody;
76+
7477
/** Control whether to ignore parameters of abstract methods. */
7578
private boolean ignoreAbstractMethods;
7679

80+
/** If set, specifies a regex of method names that should be ignored */
81+
private String ignoredMethodNames;
82+
7783
@Override
7884
public int[] getDefaultTokens() {
7985
return getAcceptableTokens();
@@ -224,7 +230,8 @@ private void processVariable(DetailAST ast) {
224230

225231
if ((frame.containsStaticField(name) || isInstanceField(ast, name))
226232
&& isMatchingRegexp(name) == false
227-
&& isIgnoredParam(ast, name) == false) {
233+
&& isIgnoredParam(ast, name) == false
234+
&& isIgnoredVariable(ast, name) == false) {
228235
log(nameAST, MSG_KEY, name);
229236
}
230237
}
@@ -238,7 +245,14 @@ && isIgnoredParam(ast, name) == false) {
238245
* @return true if parameter is ignored.
239246
*/
240247
private boolean isIgnoredParam(DetailAST ast, String name) {
241-
return isIgnoredSetterParam(ast, name) || isIgnoredConstructorParam(ast) || isIgnoredParamOfAbstractMethod(ast);
248+
return isVariableInIgnoredMethod(ast, name)
249+
|| isIgnoredSetterParam(ast, name)
250+
|| isIgnoredConstructorParam(ast)
251+
|| isIgnoredParamOfAbstractMethod(ast);
252+
}
253+
254+
private boolean isIgnoredVariable(DetailAST ast, String name) {
255+
return isIgnoredVariableInConstructorBody(ast, name);
242256
}
243257

244258
/**
@@ -410,6 +424,42 @@ private boolean isIgnoredParamOfAbstractMethod(DetailAST ast) {
410424
return result;
411425
}
412426

427+
/**
428+
* Decides whether to ignore an AST node that is the parameter of a method whose
429+
* name matches the {@link #ignoredMethodNames} regex, if set.
430+
* @param ast the AST to check
431+
* @return true is the ast should be ignored because the parameter belongs to a
432+
* method whose name matches the regex.
433+
*/
434+
private boolean isVariableInIgnoredMethod(DetailAST ast, String name) {
435+
boolean result = false;
436+
if (ignoredMethodNames != null && (ast.getType() == TokenTypes.PARAMETER_DEF || ast.getType() == TokenTypes.VARIABLE_DEF)) {
437+
DetailAST method = ast.getParent();
438+
while (method != null && method.getType() != TokenTypes.METHOD_DEF) {
439+
method = method.getParent();
440+
}
441+
if (method != null && method.getType() == TokenTypes.METHOD_DEF) {
442+
final String methodName = method.findFirstToken(TokenTypes.IDENT).getText();
443+
result = methodName.matches(ignoredMethodNames);
444+
}
445+
}
446+
return result;
447+
}
448+
449+
private boolean isIgnoredVariableInConstructorBody(DetailAST ast, String name) {
450+
boolean result = false;
451+
452+
if (ignoreConstructorBody && ast.getType() == TokenTypes.VARIABLE_DEF) {
453+
DetailAST method = ast.getParent();
454+
while (method != null && method.getType() != TokenTypes.CTOR_DEF) {
455+
method = method.getParent();
456+
}
457+
result = method != null && method.getType() == TokenTypes.CTOR_DEF;
458+
}
459+
460+
return result;
461+
}
462+
413463
/**
414464
* Setter to define the RegExp for names of variables and parameters to ignore.
415465
*
@@ -463,6 +513,14 @@ public void setIgnoreAbstractMethods(boolean ignoreAbstractMethods) {
463513
this.ignoreAbstractMethods = ignoreAbstractMethods;
464514
}
465515

516+
public void setIgnoredMethodNames(String ignoredMethodNames) {
517+
this.ignoredMethodNames = ignoredMethodNames;
518+
}
519+
520+
public void setIgnoreConstructorBody(boolean ignoreConstructorBody) {
521+
this.ignoreConstructorBody = ignoreConstructorBody;
522+
}
523+
466524
/**
467525
* Holds the names of static and instance fields of a type.
468526
*/

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchTestBasePlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public void execute(Task t) {
9797
"-Xmx" + System.getProperty("tests.heap.size", "512m"),
9898
"-Xms" + System.getProperty("tests.heap.size", "512m"),
9999
"--illegal-access=deny",
100+
"-Djava.security.manager=allow",
100101
// TODO: only open these for mockito when it is modularized
101102
"--add-opens=java.base/java.security.cert=ALL-UNNAMED",
102103
"--add-opens=java.base/java.nio.channels=ALL-UNNAMED",

build-tools-internal/src/main/resources/checkstyle.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@
111111
<!--
112112
<module name="org.elasticsearch.gradle.internal.checkstyle.HiddenFieldCheck">
113113
<property name="ignoreConstructorParameter" value="true" />
114+
<property name="ignoreConstructorBody" value="true"/>
114115
<property name="ignoreSetter" value="true" />
115116
<property name="setterCanReturnItsClass" value="true"/>
116-
<property name="ignoreFormat" value="^(threadPool)$"/>
117+
<property name="ignoreFormat" value="^(?:threadPool)$"/>
117118
<property name="ignoreAbstractMethods" value="true"/>
119+
<property name="ignoredMethodNames" value="^(?:createParser)$"/>
118120
<message key="hidden.field" value="''{0}'' hides a field." />
119121
</module>
120122
-->

build-tools/src/main/java/org/elasticsearch/gradle/Version.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public enum Mode {
3939

4040
private static final Pattern pattern = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(?:-(alpha\\d+|beta\\d+|rc\\d+|SNAPSHOT))?");
4141

42-
private static final Pattern relaxedPattern = Pattern.compile("v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([a-zA-Z0-9_]+(?:-[a-zA-Z0-9]+)*))?");
42+
private static final Pattern relaxedPattern = Pattern.compile(
43+
"v?(\\d+)\\.(\\d+)\\.(\\d+)(?:[\\-+]+([a-zA-Z0-9_]+(?:-[a-zA-Z0-9]+)*))?"
44+
);
4345

4446
public Version(int major, int minor, int revision) {
4547
this(major, minor, revision, null);

build-tools/src/test/java/org/elasticsearch/gradle/VersionTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public void testRelaxedVersionParsing() {
4141
assertVersionEquals("6.1.2-foo", 6, 1, 2, Version.Mode.RELAXED);
4242
assertVersionEquals("6.1.2-foo-bar", 6, 1, 2, Version.Mode.RELAXED);
4343
assertVersionEquals("16.01.22", 16, 1, 22, Version.Mode.RELAXED);
44+
assertVersionEquals("20.10.10+dfsg1", 20, 10, 10, Version.Mode.RELAXED);
4445
}
4546

4647
public void testCompareWithStringVersions() {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ static Request cancelTasks(CancelTasksRequest req) {
3434
}
3535

3636
static Request listTasks(ListTasksRequest listTaskRequest) {
37-
if (listTaskRequest.getTaskId() != null && listTaskRequest.getTaskId().isSet()) {
38-
throw new IllegalArgumentException("TaskId cannot be used for list tasks request");
37+
if (listTaskRequest.getTargetTaskId() != null && listTaskRequest.getTargetTaskId().isSet()) {
38+
throw new IllegalArgumentException("TargetTaskId cannot be used for list tasks request");
3939
}
4040
Request request = new Request(HttpGet.METHOD_NAME, "/_tasks");
4141
RequestConverters.Params params = new RequestConverters.Params();
4242
params.withTimeout(listTaskRequest.getTimeout())
4343
.withDetailed(listTaskRequest.getDetailed())
4444
.withWaitForCompletion(listTaskRequest.getWaitForCompletion())
45-
.withParentTaskId(listTaskRequest.getParentTaskId())
45+
.withParentTaskId(listTaskRequest.getTargetParentTaskId())
4646
.withNodes(listTaskRequest.getNodes())
4747
.withActions(listTaskRequest.getActions())
4848
.putParam("group_by", "none");

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void testListTasks() {
7272
if (randomBoolean()) {
7373
if (randomBoolean()) {
7474
TaskId taskId = new TaskId(randomAlphaOfLength(5), randomNonNegativeLong());
75-
request.setParentTaskId(taskId);
75+
request.setTargetParentTaskId(taskId);
7676
expectedParams.put("parent_task_id", taskId.toString());
7777
} else {
7878
request.setParentTask(TaskId.EMPTY_TASK_ID);
@@ -102,12 +102,12 @@ public void testListTasks() {
102102
}
103103
{
104104
ListTasksRequest request = new ListTasksRequest();
105-
request.setTaskId(new TaskId(randomAlphaOfLength(5), randomNonNegativeLong()));
105+
request.setTargetTaskId(new TaskId(randomAlphaOfLength(5), randomNonNegativeLong()));
106106
IllegalArgumentException exception = expectThrows(
107107
IllegalArgumentException.class,
108108
() -> TasksRequestConverters.listTasks(request)
109109
);
110-
assertEquals("TaskId cannot be used for list tasks request", exception.getMessage());
110+
assertEquals("TargetTaskId cannot be used for list tasks request", exception.getMessage());
111111
}
112112
}
113113
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void testListTasks() throws IOException {
6767
// tag::list-tasks-request-filter
6868
request.setActions("cluster:*"); // <1>
6969
request.setNodes("nodeId1", "nodeId2"); // <2>
70-
request.setParentTaskId(new TaskId("parentTaskId", 42)); // <3>
70+
request.setTargetParentTaskId(new TaskId("parentTaskId", 42)); // <3>
7171
// end::list-tasks-request-filter
7272

7373
// tag::list-tasks-request-detailed

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/BaseKeyStoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import joptsimple.OptionSpec;
1313

1414
import org.elasticsearch.cli.ExitCodes;
15-
import org.elasticsearch.cli.KeyStoreAwareCommand;
1615
import org.elasticsearch.cli.Terminal;
1716
import org.elasticsearch.cli.UserException;
17+
import org.elasticsearch.common.cli.KeyStoreAwareCommand;
1818
import org.elasticsearch.common.settings.KeyStoreWrapper;
1919
import org.elasticsearch.common.settings.SecureString;
2020
import org.elasticsearch.env.Environment;

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/CreateKeyStoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import joptsimple.OptionSpec;
1313

1414
import org.elasticsearch.cli.ExitCodes;
15-
import org.elasticsearch.cli.KeyStoreAwareCommand;
1615
import org.elasticsearch.cli.Terminal;
1716
import org.elasticsearch.cli.UserException;
17+
import org.elasticsearch.common.cli.KeyStoreAwareCommand;
1818
import org.elasticsearch.common.settings.KeyStoreWrapper;
1919
import org.elasticsearch.common.settings.SecureString;
2020
import org.elasticsearch.env.Environment;

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/HasPasswordKeyStoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
import joptsimple.OptionSet;
1212

13-
import org.elasticsearch.cli.KeyStoreAwareCommand;
1413
import org.elasticsearch.cli.Terminal;
1514
import org.elasticsearch.cli.UserException;
15+
import org.elasticsearch.common.cli.KeyStoreAwareCommand;
1616
import org.elasticsearch.common.settings.KeyStoreWrapper;
1717
import org.elasticsearch.env.Environment;
1818

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/KeyStoreCli.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
package org.elasticsearch.cli.keystore;
1010

11-
import org.elasticsearch.cli.LoggingAwareMultiCommand;
1211
import org.elasticsearch.cli.Terminal;
12+
import org.elasticsearch.common.cli.LoggingAwareMultiCommand;
1313

1414
/**
1515
* A cli tool for managing secrets in the elasticsearch keystore.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ static List<String> systemJvmOptions() {
2727
* networkaddress.cache.negative ttl; set to -1 to cache forever.
2828
*/
2929
"-Des.networkaddress.cache.negative.ttl=10",
30+
// Allow to set the security manager.
31+
"-Djava.security.manager=allow",
3032
// pre-touch JVM emory pages during initialization
3133
"-XX:+AlwaysPreTouch",
3234
// explicitly set the stack size

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/InstallPluginCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import joptsimple.OptionSet;
1212
import joptsimple.OptionSpec;
1313

14-
import org.elasticsearch.cli.EnvironmentAwareCommand;
1514
import org.elasticsearch.cli.Terminal;
15+
import org.elasticsearch.common.cli.EnvironmentAwareCommand;
1616
import org.elasticsearch.env.Environment;
1717
import org.elasticsearch.plugins.PluginInfo;
1818

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/ListPluginsCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import joptsimple.OptionSet;
1212

1313
import org.elasticsearch.Version;
14-
import org.elasticsearch.cli.EnvironmentAwareCommand;
1514
import org.elasticsearch.cli.Terminal;
15+
import org.elasticsearch.common.cli.EnvironmentAwareCommand;
1616
import org.elasticsearch.env.Environment;
1717
import org.elasticsearch.plugins.PluginInfo;
1818

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/PluginCli.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
package org.elasticsearch.plugins.cli;
1010

1111
import org.elasticsearch.cli.Command;
12-
import org.elasticsearch.cli.LoggingAwareMultiCommand;
1312
import org.elasticsearch.cli.Terminal;
13+
import org.elasticsearch.common.cli.LoggingAwareMultiCommand;
1414
import org.elasticsearch.core.internal.io.IOUtils;
1515

1616
import java.io.IOException;

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/RemovePluginCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import joptsimple.OptionSet;
1212
import joptsimple.OptionSpec;
1313

14-
import org.elasticsearch.cli.EnvironmentAwareCommand;
1514
import org.elasticsearch.cli.Terminal;
15+
import org.elasticsearch.common.cli.EnvironmentAwareCommand;
1616
import org.elasticsearch.env.Environment;
1717

1818
import java.util.Arrays;

docs/reference/cat/shards.asciidoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ Time at which the shard became unassigned in
249249
Time (UTC)].
250250

251251
`unassigned.details`, `ud`::
252-
Details about why the shard became unassigned.
252+
Details about why the shard became unassigned. This does not explain why the
253+
shard is currently unassigned. To understand why a shard is not assigned, use
254+
the <<cluster-allocation-explain>> API.
253255

254256
`unassigned.for`, `uf`::
255257
Time at which the shard was requested to be unassigned in
@@ -258,16 +260,24 @@ Time (UTC)].
258260

259261
[[reason-unassigned]]
260262
`unassigned.reason`, `ur`::
261-
Reason the shard is unassigned. Returned values are:
263+
Indicates the reason for the last change to the state of this unassigned shard.
264+
This does not explain why the shard is currently unassigned. To understand why
265+
a shard is not assigned, use the <<cluster-allocation-explain>> API. Returned
266+
values include:
262267
+
263268
* `ALLOCATION_FAILED`: Unassigned as a result of a failed allocation of the shard.
264269
* `CLUSTER_RECOVERED`: Unassigned as a result of a full cluster recovery.
265270
* `DANGLING_INDEX_IMPORTED`: Unassigned as a result of importing a dangling index.
266271
* `EXISTING_INDEX_RESTORED`: Unassigned as a result of restoring into a closed index.
272+
* `FORCED_EMPTY_PRIMARY`: The shard's allocation was last modified by forcing an empty primary using the <<cluster-reroute>> API.
273+
* `INDEX_CLOSED`: Unassigned because the index was closed.
267274
* `INDEX_CREATED`: Unassigned as a result of an API creation of an index.
268275
* `INDEX_REOPENED`: Unassigned as a result of opening a closed index.
276+
* `MANUAL_ALLOCATION`: The shard's allocation was last modified by the <<cluster-reroute>> API.
269277
* `NEW_INDEX_RESTORED`: Unassigned as a result of restoring into a new index.
270278
* `NODE_LEFT`: Unassigned as a result of the node hosting it leaving the cluster.
279+
* `NODE_RESTARTING`: Similar to `NODE_LEFT`, except that the node was registered as restarting using the <<node-lifecycle-api,Node shutdown API>>.
280+
* `PRIMARY_FAILED`: The shard was initializing as a replica, but the primary shard failed before the initialization completed.
271281
* `REALLOCATED_REPLICA`: A better replica location is identified and causes the existing replica allocation to be cancelled.
272282
* `REINITIALIZED`: When a shard moves from started back to initializing.
273283
* `REPLICA_ADDED`: Unassigned as a result of explicit addition of a replica.

docs/reference/cluster/nodes-stats.asciidoc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,6 +1899,54 @@ Size of TX packets sent by the node during internal cluster communication.
18991899
(integer)
19001900
Size, in bytes, of TX packets sent by the node during internal cluster
19011901
communication.
1902+
1903+
`inbound_handling_time_histogram`::
1904+
(array)
1905+
The distribution of the time spent handling each inbound message on a transport
1906+
thread, represented as a histogram.
1907+
+
1908+
.Properties of `inbound_handling_time_histogram`
1909+
[%collapsible]
1910+
=======
1911+
`ge_millis`::
1912+
(integer)
1913+
The inclusive lower bound of the bucket in milliseconds. Omitted on the first
1914+
bucket since this bucket has no lower bound.
1915+
1916+
`lt_millis`::
1917+
(integer)
1918+
The exclusive upper bound of the bucket in milliseconds. Omitted on the last
1919+
bucket since this bucket has no upper bound.
1920+
1921+
`count`::
1922+
(integer)
1923+
The number of times a transport thread took a period of time within the bounds
1924+
of this bucket to handle an inbound message.
1925+
=======
1926+
1927+
`outbound_handling_time_histogram`::
1928+
(array)
1929+
The distribution of the time spent sending each outbound transport message on a
1930+
transport thread, represented as a histogram.
1931+
+
1932+
.Properties of `outbound_handling_time_histogram`
1933+
[%collapsible]
1934+
=======
1935+
`ge_millis`::
1936+
(integer)
1937+
The inclusive lower bound of the bucket in milliseconds. Omitted on the first
1938+
bucket since this bucket has no lower bound.
1939+
1940+
`lt_millis`::
1941+
(integer)
1942+
The exclusive upper bound of the bucket in milliseconds. Omitted on the last
1943+
bucket since this bucket has no upper bound.
1944+
1945+
`count`::
1946+
(integer)
1947+
The number of times a transport thread took a period of time within the bounds
1948+
of this bucket to send a transport message.
1949+
=======
19021950
======
19031951

19041952
[[cluster-nodes-stats-api-response-body-http]]

0 commit comments

Comments
 (0)