Skip to content

Commit a477c70

Browse files
committed
Merge remote-tracking branch 'upstream/main' into security-stats
* upstream/main: (50 commits) Disable utf-8 parsing optimization (elastic#135172) rest-api-spec: fix master_timeout typo (elastic#135167) Fixes countDistinctWithConditions in csv-spec tests (elastic#135097) Fix test failure by checking for feature flag (elastic#135174) Fix deadlock in ThreadPoolMergeScheduler when a failing merge closes the IndexWriter (elastic#134656) Make SecureString comparisons constant time (elastic#135053) Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT test {p0=search/160_exists_query/Test exists query on mapped geo_point field with no doc values} elastic#135164 ESQL: Replace function count tests (elastic#134951) Mute org.elasticsearch.compute.aggregation.SampleBooleanAggregatorFunctionTests testSimpleWithCranky elastic#135163 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=analytics/nested_top_metrics_sort/terms order by top metrics numeric not null integer values} elastic#135162 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=analytics/nested_top_metrics_sort/terms order by top metrics numeric not null double values} elastic#135159 TSDB ingest performance: combine routing and tsdb hashing (elastic#132566) Mute org.elasticsearch.compute.aggregation.SampleBytesRefAggregatorFunctionTests testSimpleWithCranky elastic#135157 Mute org.elasticsearch.xpack.logsdb.qa.BulkStoredSourceChallengeRestIT testHistogramAggregation elastic#135156 Mute org.elasticsearch.xpack.logsdb.qa.StandardVersusStandardReindexedIntoLogsDbChallengeRestIT testHistogramAggregation elastic#135155 Mute org.elasticsearch.xpack.logsdb.qa.LogsDbVersusLogsDbReindexedIntoStandardModeChallengeRestIT testHistogramAggregation elastic#135154 Mute org.elasticsearch.xpack.logsdb.qa.BulkChallengeRestIT testHistogramAggregation elastic#135153 Mute org.elasticsearch.discovery.ClusterDisruptionIT testAckedIndexing elastic#117024 Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testMountSearchableSnapshot {p0=[9.2.0, 9.2.0, 9.2.0]} elastic#135151 Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testSearchableSnapshotUpgrade {p0=[9.2.0, 9.2.0, 9.2.0]} elastic#135150 ...
2 parents b795b2a + 8de918b commit a477c70

File tree

362 files changed

+4695
-1817
lines changed

Some content is hidden

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

362 files changed

+4695
-1817
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
package org.elasticsearch.benchmark.bytes;
10+
11+
import org.elasticsearch.common.bytes.BytesArray;
12+
import org.elasticsearch.common.logging.LogConfigurator;
13+
import org.openjdk.jmh.annotations.Benchmark;
14+
import org.openjdk.jmh.annotations.BenchmarkMode;
15+
import org.openjdk.jmh.annotations.Fork;
16+
import org.openjdk.jmh.annotations.Measurement;
17+
import org.openjdk.jmh.annotations.Mode;
18+
import org.openjdk.jmh.annotations.OutputTimeUnit;
19+
import org.openjdk.jmh.annotations.Param;
20+
import org.openjdk.jmh.annotations.Scope;
21+
import org.openjdk.jmh.annotations.Setup;
22+
import org.openjdk.jmh.annotations.State;
23+
import org.openjdk.jmh.annotations.Warmup;
24+
25+
import java.util.concurrent.TimeUnit;
26+
27+
@Warmup(iterations = 4, time = 1)
28+
@Measurement(iterations = 5, time = 1)
29+
@BenchmarkMode(Mode.Throughput)
30+
@OutputTimeUnit(TimeUnit.MILLISECONDS)
31+
@State(Scope.Thread)
32+
@Fork(value = 1)
33+
public class BytesArrayIndexOfBenchmark {
34+
35+
static {
36+
LogConfigurator.configureESLogging(); // native access requires logging to be initialized
37+
}
38+
39+
static final byte MARKER = (byte) '\n';
40+
41+
@Param(value = { "64", "127", "128", "4096", "16384", "65536", "1048576" })
42+
public int size;
43+
44+
BytesArray bytesArray;
45+
46+
@Setup
47+
public void setup() {
48+
byte[] bytes = new byte[size];
49+
bytes[bytes.length - 1] = MARKER;
50+
bytesArray = new BytesArray(bytes, 0, bytes.length);
51+
}
52+
53+
@Benchmark
54+
public int indexOf() {
55+
return bytesArray.indexOf(MARKER, 0);
56+
}
57+
58+
@Benchmark
59+
@Fork(jvmArgsPrepend = { "--add-modules=jdk.incubator.vector" })
60+
public int indexOfPanama() {
61+
return bytesArray.indexOf(MARKER, 0);
62+
}
63+
64+
@Benchmark
65+
public int withOffsetIndexOf() {
66+
return bytesArray.indexOf(MARKER, 1);
67+
}
68+
69+
@Benchmark
70+
@Fork(jvmArgsPrepend = { "--add-modules=jdk.incubator.vector" })
71+
public int withOffsetIndexPanama() {
72+
return bytesArray.indexOf(MARKER, 1);
73+
}
74+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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.bytes;
11+
12+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
13+
14+
import org.elasticsearch.test.ESTestCase;
15+
import org.openjdk.jmh.annotations.Param;
16+
17+
import java.util.Arrays;
18+
19+
public class BytesArrayIndexOfBenchmarkTests extends ESTestCase {
20+
21+
final int size;
22+
23+
public BytesArrayIndexOfBenchmarkTests(int size) {
24+
this.size = size;
25+
}
26+
27+
public void testIndexOf() {
28+
var bench = new BytesArrayIndexOfBenchmark();
29+
bench.size = size;
30+
bench.setup();
31+
assertEquals(size - 1, bench.indexOf());
32+
assertEquals(size - 1, bench.indexOfPanama());
33+
assertEquals(size - 1, bench.withOffsetIndexOf());
34+
assertEquals(size - 1, bench.withOffsetIndexPanama());
35+
}
36+
37+
@ParametersFactory
38+
public static Iterable<Object[]> parametersFactory() {
39+
try {
40+
var params = BytesArrayIndexOfBenchmark.class.getField("size").getAnnotationsByType(Param.class)[0].value();
41+
return () -> Arrays.stream(params).map(Integer::parseInt).map(i -> new Object[] { i }).iterator();
42+
} catch (NoSuchFieldException e) {
43+
throw new AssertionError(e);
44+
}
45+
}
46+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private void validateUpperBound(
255255
}
256256

257257
TransportVersionUpperBound existingUpperBound = getResources().get().getUpperBoundFromUpstream(upperBound.name());
258-
if (existingUpperBound != null) {
258+
if (existingUpperBound != null && getShouldValidatePrimaryIdNotPatch().get()) {
259259
if (upperBound.definitionId().patch() != 0 && upperBound.definitionId().base() != existingUpperBound.definitionId().base()) {
260260
throwUpperBoundFailure(
261261
upperBound,

distribution/src/config/jvm.options

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@
6565
# Lucene 10: apply MADV_NORMAL advice to enable more aggressive readahead
6666
-Dorg.apache.lucene.store.defaultReadAdvice=normal
6767

68+
# Lucene provides a mechanism for shared mmapped arenas to be referenced between multiple threads
69+
# this is to get around potential performance issues when closing shared arenas on many threads
70+
# default to 1 to disable this feature
71+
-Dorg.apache.lucene.store.MMapDirectory.sharedArenaMaxPermits=1
72+
6873
## heap dumps
6974

7075
# generate a heap dump when an allocation from the Java heap fails; heap dumps

docs/changelog/134656.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 134656
2+
summary: Fix deadlock in `ThreadPoolMergeScheduler` when a failing merge closes the
3+
`IndexWriter`
4+
area: Engine
5+
type: bug
6+
issues: []

docs/changelog/135012.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 135012
2+
summary: Bypass MMap arena grouping as this has caused issues with too many regions
3+
being mapped
4+
area: "Engine"
5+
type: bug
6+
issues: []

docs/changelog/135053.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 135053
2+
summary: Make `SecureString` comparisons constant time
3+
area: Infra/Core
4+
type: enhancement
5+
issues: []

docs/changelog/135087.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 135087
2+
summary: "Optimize `BytesArray::indexOf,` which is used heavily in ndjson parsing"
3+
area: "Performance"
4+
type: feature
5+
issues: []

docs/changelog/135097.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 135097
2+
summary: Fixes `countDistinctWithConditions` in csv-spec tests
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 134380

libs/simdvec/src/main/java/org/elasticsearch/simdvec/ESVectorUtil.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.lang.invoke.MethodHandle;
2020
import java.lang.invoke.MethodHandles;
2121
import java.lang.invoke.MethodType;
22+
import java.util.Objects;
2223

2324
import static org.elasticsearch.simdvec.internal.vectorization.ESVectorUtilSupport.B_QUERY;
2425

@@ -399,4 +400,22 @@ public static void transposeHalfByte(int[] q, byte[] quantQueryByte) {
399400
}
400401
IMPL.transposeHalfByte(q, quantQueryByte);
401402
}
403+
404+
/**
405+
* Searches for the first occurrence of the given marker byte in the specified range of the array.
406+
*
407+
* <p>The search starts at {@code offset} and examines at most {@code length} bytes. The return
408+
* value is the relative index of the first occurrence of {@code marker} within this slice,
409+
* or {@code -1} if not found.
410+
*
411+
* @param bytes the byte array to search
412+
* @param offset the starting index within the array
413+
* @param length the number of bytes to examine
414+
* @param marker the byte to search for
415+
* @return the relative index (0..length-1) of the first match, or {@code -1} if not found
416+
*/
417+
public static int indexOf(byte[] bytes, int offset, int length, byte marker) {
418+
Objects.checkFromIndexSize(offset, length, bytes.length);
419+
return IMPL.indexOf(bytes, offset, length, marker);
420+
}
402421
}

0 commit comments

Comments
 (0)