Skip to content

Commit 6eeb628

Browse files
committed
Merge branch 'master' into ccr
* master: HLRC: Move commercial clients from XPackClient (#32596) Add cluster UUID to Cluster Stats API response (#32206) Security: move User to protocol project (#32367) [TEST] Test for shard failures, add debug to testProfileMatchesRegular Minor fix for javadoc (applicable for java 11). (#32573) Painless: Move Some Lookup Logic to PainlessLookup (#32565) TEST: Avoid merges in testSeqNoAndCheckpoints [Rollup] Remove builders from HistoGroupConfig (#32533) Mutes failing SQL string function tests due to #32589 fixed elements in array of produced terms (#32519) INGEST: Enable default pipelines (#32286) Remove cluster state initial customs (#32501) Mutes LicensingDocumentationIT due to #32580 [ML] Remove multiple_bucket_spans (#32496) [ML] Rename JobProvider to JobResultsProvider (#32551) Correct minor typo in explain.asciidoc for HLRC Build: Add elastic maven to repos used by BuildPlugin (#32549) Clarify the error message when a pipeline agg is used in the 'order' parameter. (#32522) Revert "[test] turn on host io cache for opensuse (#32053)" Enable packaging tests on suse boxes [ML] Improve error when no available field exists for rule scope (#32550) [ML] Improve error for functions with limited rule condition support (#32548) Painless: Clean Up PainlessField (#32525) Add @AwaitsFix for #32554 Remove broken @link in Javadoc Scripting: Conditionally use java time api in scripting (#31441) [ML] Fix thread leak when waiting for job flush (#32196) (#32541) Add AwaitsFix to failing test - see #32546 Core: Minor size reduction for AbstractComponent (#32509) SQL: Added support for string manipulating functions with more than one parameter (#32356) [DOCS] Reloadable Secure Settings (#31713) Watcher: Reenable HttpSecretsIntegrationTests#testWebhookAction test (#32456) [Rollup] Remove builders from TermsGroupConfig (#32507) Use hostname instead of IP with SPNEGO test (#32514) Switch x-pack rolling restart to new style Requests (#32339) NETWORKING: Fix Netty Leaks by upgrading to 4.1.28 (#32511) [DOCS] Small fixes in rule configuration page (#32516) Painless: Clean up PainlessMethod (#32476) Build: Remove shadowing from benchmarks (#32475) Docs: Add all JDKs to CONTRIBUTING.md Add licensing enforcement for FIPS mode (#32437) SQL: Add test for handling of partial results (#32474) Mute testFilterCacheStats [ML][DOCS] Fix typo applied_to => applies_to Scripting: Fix painless compiler loader to know about context classes (#32385)
2 parents 2387616 + 9dcf3f5 commit 6eeb628

File tree

399 files changed

+7299
-2071
lines changed

Some content is hidden

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

399 files changed

+7299
-2071
lines changed

CONTRIBUTING.md

+6
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ JDK 10 and testing on a JDK 8 runtime; to do this, set `RUNTIME_JAVA_HOME`
100100
pointing to the Java home of a JDK 8 installation. Note that this mechanism can
101101
be used to test against other JDKs as well, this is not only limited to JDK 8.
102102

103+
> Note: It is also required to have `JAVA7_HOME`, `JAVA8_HOME` and
104+
`JAVA10_HOME` available so that the tests can pass.
105+
106+
> Warning: do not use `sdkman` for Java installations which do not have proper
107+
`jrunscript` for jdk distributions.
108+
103109
Elasticsearch uses the Gradle wrapper for its build. You can execute Gradle
104110
using the wrapper via the `gradlew` script in the root of the repository.
105111

Vagrantfile

-5
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ Vagrant.configure(2) do |config|
115115
'opensuse-42'.tap do |box|
116116
config.vm.define box, define_opts do |config|
117117
config.vm.box = 'elastic/opensuse-42-x86_64'
118-
119-
# https://github.com/elastic/elasticsearch/issues/30295
120-
config.vm.provider 'virtualbox' do |vbox|
121-
vbox.customize ['storagectl', :id, '--name', 'SATA Controller', '--hostiocache', 'on']
122-
end
123118
suse_common config, box
124119
end
125120
end

benchmarks/README.md

+20-17
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,39 @@ This directory contains the microbenchmark suite of Elasticsearch. It relies on
44

55
## Purpose
66

7-
We do not want to microbenchmark everything but the kitchen sink and should typically rely on our
8-
[macrobenchmarks](https://elasticsearch-benchmarks.elastic.co/app/kibana#/dashboard/Nightly-Benchmark-Overview) with
9-
[Rally](http://github.com/elastic/rally). Microbenchmarks are intended to spot performance regressions in performance-critical components.
7+
We do not want to microbenchmark everything but the kitchen sink and should typically rely on our
8+
[macrobenchmarks](https://elasticsearch-benchmarks.elastic.co/app/kibana#/dashboard/Nightly-Benchmark-Overview) with
9+
[Rally](http://github.com/elastic/rally). Microbenchmarks are intended to spot performance regressions in performance-critical components.
1010
The microbenchmark suite is also handy for ad-hoc microbenchmarks but please remove them again before merging your PR.
1111

1212
## Getting Started
1313

14-
Just run `gradle :benchmarks:jmh` from the project root directory. It will build all microbenchmarks, execute them and print the result.
14+
Just run `gradlew -p benchmarks run` from the project root
15+
directory. It will build all microbenchmarks, execute them and print
16+
the result.
1517

1618
## Running Microbenchmarks
1719

18-
Benchmarks are always run via Gradle with `gradle :benchmarks:jmh`.
19-
20-
Running via an IDE is not supported as the results are meaningless (we have no control over the JVM running the benchmarks).
20+
Running via an IDE is not supported as the results are meaningless
21+
because we have no control over the JVM running the benchmarks.
2122

22-
If you want to run a specific benchmark class, e.g. `org.elasticsearch.benchmark.MySampleBenchmark` or have special requirements
23-
generate the uberjar with `gradle :benchmarks:jmhJar` and run it directly with:
23+
If you want to run a specific benchmark class like, say,
24+
`MemoryStatsBenchmark`, you can use `--args`:
2425

2526
```
26-
java -jar benchmarks/build/distributions/elasticsearch-benchmarks-*.jar
27+
gradlew -p benchmarks run --args ' MemoryStatsBenchmark'
2728
```
2829

29-
JMH supports lots of command line parameters. Add `-h` to the command above to see the available command line options.
30+
Everything in the `'` gets sent on the command line to JMH. The leading ` `
31+
inside the `'`s is important. Without it parameters are sometimes sent to
32+
gradle.
3033

3134
## Adding Microbenchmarks
3235

33-
Before adding a new microbenchmark, make yourself familiar with the JMH API. You can check our existing microbenchmarks and also the
36+
Before adding a new microbenchmark, make yourself familiar with the JMH API. You can check our existing microbenchmarks and also the
3437
[JMH samples](http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/).
3538

36-
In contrast to tests, the actual name of the benchmark class is not relevant to JMH. However, stick to the naming convention and
39+
In contrast to tests, the actual name of the benchmark class is not relevant to JMH. However, stick to the naming convention and
3740
end the class name of a benchmark with `Benchmark`. To have JMH execute a benchmark, annotate the respective methods with `@Benchmark`.
3841

3942
## Tips and Best Practices
@@ -42,15 +45,15 @@ To get realistic results, you should exercise care when running benchmarks. Here
4245

4346
### Do
4447

45-
* Ensure that the system executing your microbenchmarks has as little load as possible. Shutdown every process that can cause unnecessary
48+
* Ensure that the system executing your microbenchmarks has as little load as possible. Shutdown every process that can cause unnecessary
4649
runtime jitter. Watch the `Error` column in the benchmark results to see the run-to-run variance.
4750
* Ensure to run enough warmup iterations to get the benchmark into a stable state. If you are unsure, don't change the defaults.
4851
* Avoid CPU migrations by pinning your benchmarks to specific CPU cores. On Linux you can use `taskset`.
49-
* Fix the CPU frequency to avoid Turbo Boost from kicking in and skewing your results. On Linux you can use `cpufreq-set` and the
52+
* Fix the CPU frequency to avoid Turbo Boost from kicking in and skewing your results. On Linux you can use `cpufreq-set` and the
5053
`performance` CPU governor.
5154
* Vary the problem input size with `@Param`.
5255
* Use the integrated profilers in JMH to dig deeper if benchmark results to not match your hypotheses:
53-
* Run the generated uberjar directly and use `-prof gc` to check whether the garbage collector runs during a microbenchmarks and skews
56+
* Run the generated uberjar directly and use `-prof gc` to check whether the garbage collector runs during a microbenchmarks and skews
5457
your results. If so, try to force a GC between runs (`-gc true`) but watch out for the caveats.
5558
* Use `-prof perf` or `-prof perfasm` (both only available on Linux) to see hotspots.
5659
* Have your benchmarks peer-reviewed.
@@ -59,4 +62,4 @@ To get realistic results, you should exercise care when running benchmarks. Here
5962

6063
* Blindly believe the numbers that your microbenchmark produces but verify them by measuring e.g. with `-prof perfasm`.
6164
* Run more threads than your number of CPU cores (in case you run multi-threaded microbenchmarks).
62-
* Look only at the `Score` column and ignore `Error`. Instead take countermeasures to keep `Error` low / variance explainable.
65+
* Look only at the `Score` column and ignore `Error`. Instead take countermeasures to keep `Error` low / variance explainable.

benchmarks/build.gradle

+3-25
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
*/
1919

2020
apply plugin: 'elasticsearch.build'
21-
22-
// order of this section matters, see: https://github.com/johnrengelman/shadow/issues/336
23-
apply plugin: 'application' // have the shadow plugin provide the runShadow task
21+
apply plugin: 'application'
2422
mainClassName = 'org.openjdk.jmh.Main'
25-
apply plugin: 'com.github.johnrengelman.shadow' // build an uberjar with all benchmarks
2623

2724
// Not published so no need to assemble
2825
tasks.remove(assemble)
@@ -50,10 +47,8 @@ compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-u
5047
// needs to be added separately otherwise Gradle will quote it and javac will fail
5148
compileJava.options.compilerArgs.addAll(["-processor", "org.openjdk.jmh.generators.BenchmarkProcessor"])
5249

53-
forbiddenApis {
54-
// classes generated by JMH can use all sorts of forbidden APIs but we have no influence at all and cannot exclude these classes
55-
ignoreFailures = true
56-
}
50+
// classes generated by JMH can use all sorts of forbidden APIs but we have no influence at all and cannot exclude these classes
51+
forbiddenApisMain.enabled = false
5752

5853
// No licenses for our benchmark deps (we don't ship benchmarks)
5954
dependencyLicenses.enabled = false
@@ -69,20 +64,3 @@ thirdPartyAudit.excludes = [
6964
'org.openjdk.jmh.profile.HotspotRuntimeProfiler',
7065
'org.openjdk.jmh.util.Utils'
7166
]
72-
73-
runShadow {
74-
executable = new File(project.runtimeJavaHome, 'bin/java')
75-
}
76-
77-
// alias the shadowJar and runShadow tasks to abstract from the concrete plugin that we are using and provide a more consistent interface
78-
task jmhJar(
79-
dependsOn: shadowJar,
80-
description: 'Generates an uberjar with the microbenchmarks and all dependencies',
81-
group: 'Benchmark'
82-
)
83-
84-
task jmh(
85-
dependsOn: runShadow,
86-
description: 'Runs all microbenchmarks',
87-
group: 'Benchmark'
88-
)

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

+9
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ class BuildPlugin implements Plugin<Project> {
405405
repos.mavenLocal()
406406
}
407407
repos.mavenCentral()
408+
repos.maven {
409+
name "elastic"
410+
url "https://artifacts.elastic.co/maven"
411+
}
408412
String luceneVersion = VersionProperties.lucene
409413
if (luceneVersion.contains('-snapshot')) {
410414
// extract the revision number from the version with a regex matcher
@@ -777,11 +781,16 @@ class BuildPlugin implements Plugin<Project> {
777781
systemProperty property.getKey(), property.getValue()
778782
}
779783
}
784+
785+
// TODO: remove this once joda time is removed from scriptin in 7.0
786+
systemProperty 'es.scripting.use_java_time', 'true'
787+
780788
// Set the system keystore/truststore password if we're running tests in a FIPS-140 JVM
781789
if (project.inFipsJvm) {
782790
systemProperty 'javax.net.ssl.trustStorePassword', 'password'
783791
systemProperty 'javax.net.ssl.keyStorePassword', 'password'
784792
}
793+
785794
boolean assertionsEnabled = Boolean.parseBoolean(System.getProperty('tests.asserts', 'true'))
786795
enableSystemAssertions assertionsEnabled
787796
enableAssertions assertionsEnabled

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

+2-10
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,7 @@ class VagrantTestPlugin implements Plugin<Project> {
526526
project.gradle.removeListener(batsPackagingReproListener)
527527
}
528528
if (project.extensions.esvagrant.boxes.contains(box)) {
529-
// these tests are temporarily disabled for suse boxes while we debug an issue
530-
// https://github.com/elastic/elasticsearch/issues/30295
531-
if (box.equals("opensuse-42") == false && box.equals("sles-12") == false) {
532-
packagingTest.dependsOn(batsPackagingTest)
533-
}
529+
packagingTest.dependsOn(batsPackagingTest)
534530
}
535531
}
536532

@@ -569,11 +565,7 @@ class VagrantTestPlugin implements Plugin<Project> {
569565
project.gradle.removeListener(javaPackagingReproListener)
570566
}
571567
if (project.extensions.esvagrant.boxes.contains(box)) {
572-
// these tests are temporarily disabled for suse boxes while we debug an issue
573-
// https://github.com/elastic/elasticsearch/issues/30295
574-
if (box.equals("opensuse-42") == false && box.equals("sles-12") == false) {
575-
packagingTest.dependsOn(javaPackagingTest)
576-
}
568+
packagingTest.dependsOn(javaPackagingTest)
577569
}
578570

579571
/*

client/benchmark/README.md

+22-13
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,54 @@
22

33
1. Build `client-benchmark-noop-api-plugin` with `gradle :client:client-benchmark-noop-api-plugin:assemble`
44
2. Install it on the target host with `bin/elasticsearch-plugin install file:///full/path/to/client-benchmark-noop-api-plugin.zip`
5-
3. Start Elasticsearch on the target host (ideally *not* on the same machine)
6-
4. Build an uberjar with `gradle :client:benchmark:shadowJar` and execute it.
5+
3. Start Elasticsearch on the target host (ideally *not* on the machine
6+
that runs the benchmarks)
7+
4. Run the benchmark with
8+
```
9+
./gradlew -p client/benchmark run --args ' params go here'
10+
```
711

8-
Repeat all steps above for the other benchmark candidate.
12+
Everything in the `'` gets sent on the command line to JMH. The leading ` `
13+
inside the `'`s is important. Without it parameters are sometimes sent to
14+
gradle.
15+
16+
See below for some example invocations.
917

1018
### Example benchmark
1119

1220
In general, you should define a few GC-related settings `-Xms8192M -Xmx8192M -XX:+UseConcMarkSweepGC -verbose:gc -XX:+PrintGCDetails` and keep an eye on GC activity. You can also define `-XX:+PrintCompilation` to see JIT activity.
1321

1422
#### Bulk indexing
1523

16-
Download benchmark data from http://benchmarks.elastic.co/corpora/geonames/documents.json.bz2 and decompress them.
24+
Download benchmark data from http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/geonames and decompress them.
1725

18-
Example command line parameters:
26+
Example invocation:
1927

2028
```
21-
rest bulk 192.168.2.2 ./documents.json geonames type 8647880 5000
29+
wget http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/geonames/documents-2.json.bz2
30+
bzip2 -d documents-2.json.bz2
31+
mv documents-2.json client/benchmark/build
32+
gradlew -p client/benchmark run --args ' rest bulk localhost build/documents-2.json geonames type 8647880 5000'
2233
```
2334

24-
The parameters are in order:
35+
The parameters are all in the `'`s and are in order:
2536

2637
* Client type: Use either "rest" or "transport"
2738
* Benchmark type: Use either "bulk" or "search"
2839
* Benchmark target host IP (the host where Elasticsearch is running)
2940
* full path to the file that should be bulk indexed
3041
* name of the index
31-
* name of the (sole) type in the index
42+
* name of the (sole) type in the index
3243
* number of documents in the file
3344
* bulk size
3445

3546

36-
#### Bulk indexing
47+
#### Search
3748

38-
Example command line parameters:
49+
Example invocation:
3950

4051
```
41-
rest search 192.168.2.2 geonames "{ \"query\": { \"match_phrase\": { \"name\": \"Sankt Georgen\" } } }\"" 500,1000,1100,1200
52+
gradlew -p client/benchmark run --args ' rest search localhost geonames {"query":{"match_phrase":{"name":"Sankt Georgen"}}} 500,1000,1100,1200'
4253
```
4354

4455
The parameters are in order:
@@ -49,5 +60,3 @@ The parameters are in order:
4960
* name of the index
5061
* a search request body (remember to escape double quotes). The `TransportClientBenchmark` uses `QueryBuilders.wrapperQuery()` internally which automatically adds a root key `query`, so it must not be present in the command line parameter.
5162
* A comma-separated list of target throughput rates
52-
53-

client/benchmark/build.gradle

-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
*/
1919

2020
apply plugin: 'elasticsearch.build'
21-
// build an uberjar with all benchmarks
22-
apply plugin: 'com.github.johnrengelman.shadow'
23-
// have the shadow plugin provide the runShadow task
2421
apply plugin: 'application'
2522

2623
group = 'org.elasticsearch.client'
@@ -32,7 +29,6 @@ build.dependsOn.remove('assemble')
3229
archivesBaseName = 'client-benchmarks'
3330
mainClassName = 'org.elasticsearch.client.benchmark.BenchmarkMain'
3431

35-
3632
// never try to invoke tests on the benchmark project - there aren't any
3733
test.enabled = false
3834

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

+28-6
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ public class RestHighLevelClient implements Closeable {
205205
private final SnapshotClient snapshotClient = new SnapshotClient(this);
206206
private final TasksClient tasksClient = new TasksClient(this);
207207
private final XPackClient xPackClient = new XPackClient(this);
208+
private final WatcherClient watcherClient = new WatcherClient(this);
209+
private final LicenseClient licenseClient = new LicenseClient(this);
208210

209211
/**
210212
* Creates a {@link RestHighLevelClient} given the low level {@link RestClientBuilder} that allows to build the
@@ -296,18 +298,38 @@ public final TasksClient tasks() {
296298
}
297299

298300
/**
299-
* A wrapper for the {@link RestHighLevelClient} that provides methods for
300-
* accessing the Elastic Licensed X-Pack APIs that are shipped with the
301-
* default distribution of Elasticsearch. All of these APIs will 404 if run
302-
* against the OSS distribution of Elasticsearch.
301+
* Provides methods for accessing the Elastic Licensed X-Pack Info
302+
* and Usage APIs that are shipped with the default distribution of
303+
* Elasticsearch. All of these APIs will 404 if run against the OSS
304+
* distribution of Elasticsearch.
303305
* <p>
304-
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-api.html">
305-
* X-Pack APIs on elastic.co</a> for more information.
306+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html">
307+
* Info APIs on elastic.co</a> for more information.
306308
*/
307309
public final XPackClient xpack() {
308310
return xPackClient;
309311
}
310312

313+
/**
314+
* Provides methods for accessing the Elastic Licensed Watcher APIs that
315+
* are shipped with the default distribution of Elasticsearch. All of
316+
* these APIs will 404 if run against the OSS distribution of Elasticsearch.
317+
* <p>
318+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api.html">
319+
* Watcher APIs on elastic.co</a> for more information.
320+
*/
321+
public WatcherClient watcher() { return watcherClient; }
322+
323+
/**
324+
* Provides methods for accessing the Elastic Licensed Licensing APIs that
325+
* are shipped with the default distribution of Elasticsearch. All of
326+
* these APIs will 404 if run against the OSS distribution of Elasticsearch.
327+
* <p>
328+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/licensing-apis.html">
329+
* Licensing APIs on elastic.co</a> for more information.
330+
*/
331+
public LicenseClient license() { return licenseClient; }
332+
311333
/**
312334
* Executes a bulk request using the Bulk API.
313335
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk API on elastic.co</a>

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

-19
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,9 @@
4141
public final class XPackClient {
4242

4343
private final RestHighLevelClient restHighLevelClient;
44-
private final WatcherClient watcherClient;
45-
private final LicenseClient licenseClient;
4644

4745
XPackClient(RestHighLevelClient restHighLevelClient) {
4846
this.restHighLevelClient = restHighLevelClient;
49-
this.watcherClient = new WatcherClient(restHighLevelClient);
50-
this.licenseClient = new LicenseClient(restHighLevelClient);
51-
}
52-
53-
public WatcherClient watcher() {
54-
return watcherClient;
5547
}
5648

5749
/**
@@ -102,15 +94,4 @@ public void usageAsync(XPackUsageRequest request, RequestOptions options, Action
10294
restHighLevelClient.performRequestAsyncAndParseEntity(request, RequestConverters::xpackUsage, options,
10395
XPackUsageResponse::fromXContent, listener, emptySet());
10496
}
105-
106-
/**
107-
* A wrapper for the {@link RestHighLevelClient} that provides methods for
108-
* accessing the Elastic Licensing APIs.
109-
* <p>
110-
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/licensing-apis.html">
111-
* X-Pack APIs on elastic.co</a> for more information.
112-
*/
113-
public LicenseClient license() {
114-
return licenseClient;
115-
}
11697
}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,9 @@ public void testApiNamingConventions() throws Exception {
755755
method.isAnnotationPresent(Deprecated.class));
756756
} else {
757757
//TODO xpack api are currently ignored, we need to load xpack yaml spec too
758-
if (apiName.startsWith("xpack.") == false) {
758+
if (apiName.startsWith("xpack.") == false &&
759+
apiName.startsWith("license.") == false &&
760+
apiName.startsWith("watcher.") == false) {
759761
apiNotFound.add(apiName);
760762
}
761763
}

0 commit comments

Comments
 (0)