Skip to content

Commit 474a79c

Browse files
Merge branch 'main' into saml-issuer-in-warn-logs
2 parents 42ebafc + 20eb590 commit 474a79c

File tree

110 files changed

+1431
-244
lines changed

Some content is hidden

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

110 files changed

+1431
-244
lines changed

benchmarks/README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,21 @@ To get realistic results, you should exercise care when running benchmarks. Here
8282
NOTE: Linux only. Sorry Mac and Windows.
8383

8484
Disassembling is fun! Maybe not always useful, but always fun! Generally, you'll want to install `perf` and the JDK's `hsdis`.
85-
`perf` is generally available via `apg-get install perf` or `pacman -S perf`. `hsdis` you'll want to compile from source. is a little more involved. This worked
85+
`perf` is generally available via `apg-get install perf` or `pacman -S perf linux-tools`. `hsdis` you'll want to compile from source. is a little more involved. This worked
8686
on 2020-08-01:
8787

8888
```
8989
git clone [email protected]:openjdk/jdk.git
9090
cd jdk
91-
git checkout jdk-17-ga
92-
cd src/utils/hsdis
91+
git checkout jdk-24-ga
9392
# Get a known good binutils
9493
wget https://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.gz
9594
tar xf binutils-2.35.tar.gz
96-
make BINUTILS=binutils-2.35 ARCH=amd64
97-
sudo cp build/linux-amd64/hsdis-amd64.so /usr/lib/jvm/java-17-openjdk/lib/server/
95+
bash configure --with-hsdis=binutils --with-binutils-src=binutils-2.35 \
96+
--with-boot-jdk=~/.gradle/jdks/oracle_corporation-24-amd64-linux.2
97+
make build-hsdis
98+
cp ./build/linux-x86_64-server-release/jdk/lib/hsdis-amd64.so \
99+
~/.gradle/jdks/oracle_corporation-24-amd64-linux.2/lib/hsdis.so
98100
```
99101

100102
If you want to disassemble a single method do something like this:
@@ -105,6 +107,30 @@ gradlew -p benchmarks run --args ' MemoryStatsBenchmark -jvmArgs "-XX:+UnlockDia
105107

106108
If you want `perf` to find the hot methods for you, then do add `-prof perfasm`.
107109

110+
NOTE: `perfasm` will need more access:
111+
```
112+
sudo bash
113+
echo -1 > /proc/sys/kernel/perf_event_paranoid
114+
exit
115+
```
116+
117+
If you get warnings like:
118+
```
119+
The perf event count is suspiciously low (0).
120+
```
121+
then check if you are bumping into [this](https://man.archlinux.org/man/perf-stat.1.en#INTEL_HYBRID_SUPPORT)
122+
by running:
123+
```
124+
perf stat -B dd if=/dev/zero of=/dev/null count=1000000
125+
```
126+
127+
If you see lines like:
128+
```
129+
765019980 cpu_atom/cycles/ # 1.728 GHz (0.60%)
130+
2258845959 cpu_core/cycles/ # 5.103 GHz (99.18%)
131+
```
132+
then `perf` is just not going to work for you.
133+
108134
## Async Profiler
109135

110136
Note: Linux and Mac only. Sorry Windows.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.benchmark.compute.operator;
11+
12+
import org.apache.lucene.document.InetAddressPoint;
13+
import org.apache.lucene.util.BytesRef;
14+
import org.elasticsearch.common.breaker.NoopCircuitBreaker;
15+
import org.elasticsearch.common.network.InetAddresses;
16+
import org.elasticsearch.compute.operator.BreakingBytesRefBuilder;
17+
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ParseIp;
18+
import org.openjdk.jmh.annotations.Benchmark;
19+
import org.openjdk.jmh.annotations.BenchmarkMode;
20+
import org.openjdk.jmh.annotations.Fork;
21+
import org.openjdk.jmh.annotations.Measurement;
22+
import org.openjdk.jmh.annotations.Mode;
23+
import org.openjdk.jmh.annotations.OutputTimeUnit;
24+
import org.openjdk.jmh.annotations.Scope;
25+
import org.openjdk.jmh.annotations.State;
26+
import org.openjdk.jmh.annotations.Warmup;
27+
28+
import java.net.InetAddress;
29+
import java.util.concurrent.TimeUnit;
30+
31+
@Warmup(iterations = 5)
32+
@Measurement(iterations = 7)
33+
@BenchmarkMode(Mode.AverageTime)
34+
@OutputTimeUnit(TimeUnit.NANOSECONDS)
35+
@State(Scope.Thread)
36+
@Fork(1)
37+
public class ParseIpBenchmark {
38+
private final BytesRef ip = new BytesRef("192.168.0.1");
39+
private final BreakingBytesRefBuilder scratch = ParseIp.buildScratch(new NoopCircuitBreaker("request"));
40+
41+
@Benchmark
42+
public BytesRef leadingZerosRejected() {
43+
return ParseIp.leadingZerosRejected(ip, scratch);
44+
}
45+
46+
@Benchmark
47+
public BytesRef leadingZerosAreDecimal() {
48+
return ParseIp.leadingZerosAreDecimal(ip, scratch);
49+
}
50+
51+
@Benchmark
52+
public BytesRef leadingZerosAreOctal() {
53+
return ParseIp.leadingZerosAreOctal(ip, scratch);
54+
}
55+
56+
@Benchmark
57+
public BytesRef original() {
58+
InetAddress inetAddress = InetAddresses.forString(ip.utf8ToString());
59+
return new BytesRef(InetAddressPoint.encode(inetAddress));
60+
}
61+
}

docs/changelog/125562.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 125562
2+
summary: Improve handling of empty response
3+
area: Infra/REST API
4+
type: bug
5+
issues:
6+
- 57639

docs/changelog/126338.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 126338
2+
summary: Speed up TO_IP
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_balance/10_basic.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ setup:
180180
- requires:
181181
cluster_features: ["gte_v8.8.0"]
182182
reason: "reset API added in in 8.8.0"
183+
test_runner_features: [ capabilities ]
184+
capabilities:
185+
- method: DELETE
186+
path: /_internal/desired_balance
187+
capabilities: [ plain_text_empty_response ]
183188

184189
- do:
185190
_internal.delete_desired_balance: { }

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_nodes/10_basic.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ setup:
33
- requires:
44
cluster_features: ["gte_v8.13.0"]
55
reason: "API added in in 8.1.0 but modified in 8.13 (node_version field removed)"
6+
test_runner_features: [ capabilities ]
7+
capabilities:
8+
- method: DELETE
9+
path: /_internal/desired_nodes
10+
capabilities: [ plain_text_empty_response ]
611
---
712
teardown:
813
- do:

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_nodes/11_old_format.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ setup:
66
- requires:
77
cluster_features: ["gte_v8.3.0"]
88
reason: "API added in in 8.1.0 but modified in 8.3"
9+
test_runner_features: [ capabilities ]
10+
capabilities:
11+
- method: DELETE
12+
path: /_internal/desired_nodes
13+
capabilities: [ plain_text_empty_response ]
914
---
1015
teardown:
1116
- do:

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_nodes/20_dry_run.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ setup:
33
- requires:
44
cluster_features: ["gte_v8.4.0"]
55
reason: "Support for the dry run option was added in in 8.4.0"
6+
test_runner_features: [ capabilities ]
7+
capabilities:
8+
- method: DELETE
9+
path: /_internal/desired_nodes
10+
capabilities: [ plain_text_empty_response ]
611
---
712
teardown:
813
- do:

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.voting_config_exclusions/10_basic.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
setup:
2+
- requires:
3+
test_runner_features: [ capabilities ]
4+
capabilities:
5+
- method: POST
6+
path: /_cluster/voting_config_exclusions
7+
capabilities: [ plain_text_empty_response ]
8+
- method: DELETE
9+
path: /_cluster/voting_config_exclusions
10+
capabilities: [ plain_text_empty_response ]
11+
reason: needs these capabilities
12+
13+
---
114
teardown:
215
- do:
316
cluster.delete_voting_config_exclusions: {}

server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/VotingConfigurationIT.java

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@
99
package org.elasticsearch.cluster.coordination;
1010

1111
import org.elasticsearch.ElasticsearchException;
12-
import org.elasticsearch.action.admin.cluster.configuration.AddVotingConfigExclusionsRequest;
13-
import org.elasticsearch.action.admin.cluster.configuration.TransportAddVotingConfigExclusionsAction;
12+
import org.elasticsearch.client.Request;
13+
import org.elasticsearch.client.Response;
1414
import org.elasticsearch.cluster.ClusterState;
1515
import org.elasticsearch.cluster.node.DiscoveryNode;
16+
import org.elasticsearch.cluster.service.ClusterService;
1617
import org.elasticsearch.common.Priority;
1718
import org.elasticsearch.plugins.Plugin;
1819
import org.elasticsearch.test.ESIntegTestCase;
1920
import org.elasticsearch.test.transport.MockTransportService;
2021
import org.elasticsearch.transport.TransportService;
2122

23+
import java.io.IOException;
2224
import java.util.Collection;
2325
import java.util.Collections;
2426
import java.util.List;
2527
import java.util.Set;
26-
import java.util.concurrent.ExecutionException;
2728

29+
import static org.hamcrest.Matchers.empty;
2830
import static org.hamcrest.Matchers.equalTo;
2931
import static org.hamcrest.Matchers.hasItem;
3032
import static org.hamcrest.Matchers.hasSize;
@@ -38,18 +40,39 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
3840
return Collections.singletonList(MockTransportService.TestPlugin.class);
3941
}
4042

41-
public void testAbdicateAfterVotingConfigExclusionAdded() throws ExecutionException, InterruptedException {
43+
@Override
44+
protected boolean addMockHttpTransport() {
45+
return false; // enable HTTP
46+
}
47+
48+
public void testAbdicateAfterVotingConfigExclusionAdded() throws IOException {
4249
internalCluster().setBootstrapMasterNodeIndex(0);
4350
internalCluster().startNodes(2);
4451
final String originalMaster = internalCluster().getMasterName();
52+
final var restClient = getRestClient();
4553

4654
logger.info("--> excluding master node {}", originalMaster);
47-
client().execute(
48-
TransportAddVotingConfigExclusionsAction.TYPE,
49-
new AddVotingConfigExclusionsRequest(TEST_REQUEST_TIMEOUT, originalMaster)
50-
).get();
55+
final var excludeRequest = new Request("POST", "/_cluster/voting_config_exclusions");
56+
excludeRequest.addParameter("node_names", originalMaster);
57+
assertEmptyResponse(restClient.performRequest(excludeRequest));
58+
5159
clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT).setWaitForEvents(Priority.LANGUID).get();
5260
assertNotEquals(originalMaster, internalCluster().getMasterName());
61+
62+
final var clearRequest = new Request("DELETE", "/_cluster/voting_config_exclusions");
63+
clearRequest.addParameter("wait_for_removal", "false");
64+
assertEmptyResponse(restClient.performRequest(clearRequest));
65+
66+
assertThat(
67+
internalCluster().getInstance(ClusterService.class).state().metadata().coordinationMetadata().getVotingConfigExclusions(),
68+
empty()
69+
);
70+
}
71+
72+
private void assertEmptyResponse(Response response) throws IOException {
73+
assertEquals("text/plain; charset=UTF-8", response.getHeader("content-type"));
74+
assertEquals(0, response.getEntity().getContentLength());
75+
assertEquals(0, response.getEntity().getContent().readAllBytes().length);
5376
}
5477

5578
public void testElectsNodeNotInVotingConfiguration() throws Exception {

0 commit comments

Comments
 (0)