Skip to content

Commit bdb1d5b

Browse files
committed
Merge branch 'master' into standard_shadow
2 parents 3cd2807 + 59191b4 commit bdb1d5b

File tree

300 files changed

+13289
-3931
lines changed

Some content is hidden

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

300 files changed

+13289
-3931
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.elasticsearch.benchmark.indices.breaker;
20+
21+
import org.openjdk.jmh.annotations.Benchmark;
22+
import org.openjdk.jmh.annotations.BenchmarkMode;
23+
import org.openjdk.jmh.annotations.Fork;
24+
import org.openjdk.jmh.annotations.Measurement;
25+
import org.openjdk.jmh.annotations.Mode;
26+
import org.openjdk.jmh.annotations.OutputTimeUnit;
27+
import org.openjdk.jmh.annotations.Param;
28+
import org.openjdk.jmh.annotations.Scope;
29+
import org.openjdk.jmh.annotations.State;
30+
import org.openjdk.jmh.annotations.Threads;
31+
import org.openjdk.jmh.annotations.Warmup;
32+
import org.openjdk.jmh.infra.Blackhole;
33+
34+
import java.lang.management.ManagementFactory;
35+
import java.lang.management.MemoryMXBean;
36+
import java.util.concurrent.TimeUnit;
37+
38+
@Fork(3)
39+
@Warmup(iterations = 10)
40+
@Measurement(iterations = 10)
41+
@BenchmarkMode(Mode.AverageTime)
42+
@OutputTimeUnit(TimeUnit.MICROSECONDS)
43+
@State(Scope.Benchmark)
44+
@SuppressWarnings("unused") //invoked by benchmarking framework
45+
public class MemoryStatsBenchmark {
46+
private static final MemoryMXBean MEMORY_MX_BEAN = ManagementFactory.getMemoryMXBean();
47+
48+
@Param({"0", "16", "256", "4096"})
49+
private int tokens;
50+
51+
@Benchmark
52+
public void baseline() {
53+
Blackhole.consumeCPU(tokens);
54+
}
55+
56+
@Benchmark
57+
@Threads(1)
58+
public long getMemoryStats_01() {
59+
Blackhole.consumeCPU(tokens);
60+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
61+
}
62+
63+
@Benchmark
64+
@Threads(2)
65+
public long getMemoryStats_02() {
66+
Blackhole.consumeCPU(tokens);
67+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
68+
}
69+
70+
@Benchmark
71+
@Threads(4)
72+
public long getMemoryStats_04() {
73+
Blackhole.consumeCPU(tokens);
74+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
75+
}
76+
77+
@Benchmark
78+
@Threads(8)
79+
public long getMemoryStats_08() {
80+
Blackhole.consumeCPU(tokens);
81+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
82+
}
83+
84+
@Benchmark
85+
@Threads(16)
86+
public long getMemoryStats_16() {
87+
Blackhole.consumeCPU(tokens);
88+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
89+
}
90+
91+
@Benchmark
92+
@Threads(32)
93+
public long getMemoryStats_32() {
94+
Blackhole.consumeCPU(tokens);
95+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
96+
}
97+
98+
@Benchmark
99+
@Threads(64)
100+
public long getMemoryStats_64() {
101+
Blackhole.consumeCPU(tokens);
102+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
103+
}
104+
}
105+

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@ allprojects {
472472
if (isEclipse) {
473473
// set this so generated dirs will be relative to eclipse build
474474
project.buildDir = eclipseBuild
475+
// Work around https://docs.gradle.org/current/userguide/java_gradle_plugin.html confusing Eclipse by the metadata
476+
// it adds to the classpath
477+
project.file("$buildDir/pluginUnderTestMetadata").mkdirs()
475478
}
476479
eclipse.classpath.file.whenMerged { classpath ->
477480
// give each source folder a unique corresponding output folder

buildSrc/build.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ if (project == rootProject) {
129129
}
130130
mavenCentral()
131131
}
132+
test {
133+
include "**/*Tests.class"
134+
exclude "**/*IT.class"
135+
}
132136
}
133137

134138
/*****************************************************************************
@@ -153,6 +157,18 @@ if (project != rootProject) {
153157
jarHell.enabled = false
154158
thirdPartyAudit.enabled = false
155159

160+
// tests can't be run with randomized test runner
161+
// it's fine as we run them as part of :buildSrc
162+
test.enabled = false
163+
task integTest(type: Test) {
164+
exclude "**/*Tests.class"
165+
include "**/*IT.class"
166+
testClassesDirs = sourceSets.test.output.classesDirs
167+
classpath = sourceSets.test.runtimeClasspath
168+
inputs.dir(file("src/testKit"))
169+
}
170+
check.dependsOn(integTest)
171+
156172
// TODO: re-enable once randomizedtesting gradle code is published and removed from here
157173
licenseHeaders.enabled = false
158174

buildSrc/src/main/groovy/org/elasticsearch/gradle/LoggedExec.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

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

Lines changed: 0 additions & 147 deletions
This file was deleted.

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,12 @@ class ClusterFormationTasks {
331331
}
332332
// increase script compilation limit since tests can rapid-fire script compilations
333333
esConfig['script.max_compilations_rate'] = '2048/1m'
334+
// Temporarily disable the real memory usage circuit breaker. It depends on real memory usage which we have no full control
335+
// over and the REST client will not retry on circuit breaking exceptions yet (see #31986 for details). Once the REST client
336+
// can retry on circuit breaking exceptions, we can revert again to the default configuration.
337+
if (node.nodeVersion.major >= 7) {
338+
esConfig['indices.breaker.total.use_real_memory'] = false
339+
}
334340
esConfig.putAll(node.config.settings)
335341

336342
Task writeConfig = project.tasks.create(name: name, type: DefaultTask, dependsOn: setup)

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,11 @@ class VagrantTestPlugin implements Plugin<Project> {
526526
project.gradle.removeListener(batsPackagingReproListener)
527527
}
528528
if (project.extensions.esvagrant.boxes.contains(box)) {
529-
packagingTest.dependsOn(batsPackagingTest)
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+
}
530534
}
531535
}
532536

@@ -565,7 +569,11 @@ class VagrantTestPlugin implements Plugin<Project> {
565569
project.gradle.removeListener(javaPackagingReproListener)
566570
}
567571
if (project.extensions.esvagrant.boxes.contains(box)) {
568-
packagingTest.dependsOn(javaPackagingTest)
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+
}
569577
}
570578

571579
/*

0 commit comments

Comments
 (0)