Skip to content

Commit bdcf2c5

Browse files
committed
Merge branch 'main' into esql-fix-block-randomization-tests
# Conflicts: # muted-tests.yml
2 parents 5c87aca + 1ed0278 commit bdcf2c5

File tree

107 files changed

+3272
-611
lines changed

Some content is hidden

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

107 files changed

+3272
-611
lines changed

docs/changelog/127355.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 127355
2+
summary: '`text ==` and `text !=` pushdown'
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/127877.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 127877
2+
summary: Check hidden frames in entitlements
3+
area: Infra/Core
4+
type: bug
5+
issues: []

docs/changelog/127921.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 127921
2+
summary: "[9.x] Revert \"Enable madvise by default for all builds\""
3+
area: Vector Search
4+
type: bug
5+
issues: []

libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/Util.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
package org.elasticsearch.entitlement.bridge;
1111

1212
import java.util.Optional;
13+
import java.util.Set;
1314

1415
import static java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE;
16+
import static java.lang.StackWalker.Option.SHOW_HIDDEN_FRAMES;
1517

1618
public class Util {
1719
/**
@@ -23,6 +25,8 @@ public class Util {
2325
public static final Class<?> NO_CLASS = new Object() {
2426
}.getClass();
2527

28+
private static final Set<String> skipInternalPackages = Set.of("java.lang.invoke", "java.lang.reflect", "jdk.internal.reflect");
29+
2630
/**
2731
* Why would we write this instead of using {@link StackWalker#getCallerClass()}?
2832
* Because that method throws {@link IllegalCallerException} if called from the "outermost frame",
@@ -32,9 +36,10 @@ public class Util {
3236
*/
3337
@SuppressWarnings("unused") // Called reflectively from InstrumenterImpl
3438
public static Class<?> getCallerClass() {
35-
Optional<Class<?>> callerClassIfAny = StackWalker.getInstance(RETAIN_CLASS_REFERENCE)
39+
Optional<Class<?>> callerClassIfAny = StackWalker.getInstance(Set.of(RETAIN_CLASS_REFERENCE, SHOW_HIDDEN_FRAMES))
3640
.walk(
3741
frames -> frames.skip(2) // Skip this method and its caller
42+
.filter(frame -> skipInternalPackages.contains(frame.getDeclaringClass().getPackageName()) == false)
3843
.findFirst()
3944
.map(StackWalker.StackFrame::getDeclaringClass)
4045
);

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/entitlements/FilesEntitlement.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ private static BaseDir parseBaseDir(String baseDir) {
182182
case "config" -> BaseDir.CONFIG;
183183
case "data" -> BaseDir.DATA;
184184
case "home" -> BaseDir.USER_HOME;
185-
// NOTE: shared_repo is _not_ accessible to policy files, only internally
185+
// it would be nice to limit this to just ES modules, but we don't have a way to plumb that through to here
186+
// however, we still don't document in the error case below that shared_repo is valid
187+
case "shared_repo" -> BaseDir.SHARED_REPO;
186188
default -> throw new PolicyValidationException(
187189
"invalid relative directory: " + baseDir + ", valid values: [config, data, home]"
188190
);

server/src/main/java/org/elasticsearch/common/text/Text.java renamed to libs/x-content/src/main/java/org/elasticsearch/xcontent/Text.java

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,17 @@
66
* your election, the "Elastic License 2.0", the "GNU Affero General Public
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
9-
package org.elasticsearch.common.text;
10-
11-
import org.apache.lucene.util.BytesRef;
12-
import org.elasticsearch.common.bytes.BytesArray;
13-
import org.elasticsearch.common.bytes.BytesReference;
14-
import org.elasticsearch.xcontent.ToXContentFragment;
15-
import org.elasticsearch.xcontent.XContentBuilder;
9+
package org.elasticsearch.xcontent;
1610

1711
import java.io.IOException;
12+
import java.nio.ByteBuffer;
1813
import java.nio.charset.StandardCharsets;
1914

2015
/**
21-
* Both {@link String} and {@link BytesReference} representation of the text. Starts with one of those, and if
16+
* Both {@link String} and {@link ByteBuffer} representation of the text. Starts with one of those, and if
2217
* the other is requests, caches the other one in a local reference so no additional conversion will be needed.
2318
*/
24-
public final class Text implements Comparable<Text>, ToXContentFragment {
19+
public final class Text implements XContentString, Comparable<Text>, ToXContentFragment {
2520

2621
public static final Text[] EMPTY_ARRAY = new Text[0];
2722

@@ -36,31 +31,43 @@ public static Text[] convertFromStringArray(String[] strings) {
3631
return texts;
3732
}
3833

39-
private BytesReference bytes;
34+
private ByteBuffer bytes;
4035
private String text;
4136
private int hash;
37+
private int stringLength = -1;
38+
39+
/**
40+
* Construct a Text from a UTF-8 encoded ByteBuffer. Since no string length is specified, {@link #stringLength()}
41+
* will perform a string conversion to measure the string length.
42+
*/
43+
public Text(ByteBuffer bytes) {
44+
this.bytes = bytes;
45+
}
4246

43-
public Text(BytesReference bytes) {
47+
/**
48+
* Construct a Text from a UTF-8 encoded ByteBuffer and an explicit string length. Used to avoid string conversion
49+
* in {@link #stringLength()}.
50+
*/
51+
public Text(ByteBuffer bytes, int stringLength) {
4452
this.bytes = bytes;
53+
this.stringLength = stringLength;
4554
}
4655

4756
public Text(String text) {
4857
this.text = text;
4958
}
5059

5160
/**
52-
* Whether a {@link BytesReference} view of the data is already materialized.
61+
* Whether a {@link ByteBuffer} view of the data is already materialized.
5362
*/
5463
public boolean hasBytes() {
5564
return bytes != null;
5665
}
5766

58-
/**
59-
* Returns a {@link BytesReference} view of the data.
60-
*/
61-
public BytesReference bytes() {
67+
@Override
68+
public ByteBuffer bytes() {
6269
if (bytes == null) {
63-
bytes = new BytesArray(text.getBytes(StandardCharsets.UTF_8));
70+
bytes = StandardCharsets.UTF_8.encode(text);
6471
}
6572
return bytes;
6673
}
@@ -72,11 +79,20 @@ public boolean hasString() {
7279
return text != null;
7380
}
7481

75-
/**
76-
* Returns a {@link String} view of the data.
77-
*/
82+
@Override
7883
public String string() {
79-
return text == null ? bytes.utf8ToString() : text;
84+
if (text == null) {
85+
text = StandardCharsets.UTF_8.decode(bytes).toString();
86+
}
87+
return text;
88+
}
89+
90+
@Override
91+
public int stringLength() {
92+
if (stringLength < 0) {
93+
stringLength = string().length();
94+
}
95+
return stringLength;
8096
}
8197

8298
@Override
@@ -115,8 +131,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
115131
} else {
116132
// TODO: TextBytesOptimization we can use a buffer here to convert it? maybe add a
117133
// request to jackson to support InputStream as well?
118-
BytesRef br = this.bytes().toBytesRef();
119-
return builder.utf8Value(br.bytes, br.offset, br.length);
134+
assert bytes.hasArray();
135+
return builder.utf8Value(bytes.array(), bytes.arrayOffset() + bytes.position(), bytes.remaining());
120136
}
121137
}
122138
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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.xcontent;
11+
12+
import java.nio.ByteBuffer;
13+
14+
public interface XContentString {
15+
/**
16+
* Returns a {@link String} view of the data.
17+
*/
18+
String string();
19+
20+
/**
21+
* Returns a UTF8-encoded {@link ByteBuffer} view of the data.
22+
*/
23+
ByteBuffer bytes();
24+
25+
/**
26+
* Returns the number of characters in the represented string.
27+
*/
28+
int stringLength();
29+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
org.elasticsearch.repository.url:
2+
- outbound_network
3+
- files:
4+
- relative_path: .
5+
relative_to: shared_repo
6+
mode: read
17
org.apache.httpcomponents.httpclient:
28
- outbound_network # for URLHttpClient

muted-tests.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ tests:
6666
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
6767
method: test {p0=transform/transforms_start_stop/Test start already started transform}
6868
issue: https://github.com/elastic/elasticsearch/issues/98802
69-
- class: org.elasticsearch.xpack.deprecation.DeprecationHttpIT
70-
method: testDeprecatedSettingsReturnWarnings
71-
issue: https://github.com/elastic/elasticsearch/issues/108628
7269
- class: org.elasticsearch.xpack.shutdown.NodeShutdownIT
7370
method: testAllocationPreventedForRemoval
7471
issue: https://github.com/elastic/elasticsearch/issues/116363
@@ -408,9 +405,6 @@ tests:
408405
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
409406
method: testLookupExplosionNoFetch
410407
issue: https://github.com/elastic/elasticsearch/issues/127365
411-
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT
412-
method: test
413-
issue: https://github.com/elastic/elasticsearch/issues/127536
414408
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
415409
method: test {p0=ml/data_frame_analytics_cat_apis/Test cat data frame analytics all jobs with header}
416410
issue: https://github.com/elastic/elasticsearch/issues/127625
@@ -462,6 +456,18 @@ tests:
462456
- class: org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDeciderIT
463457
method: testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleRestores
464458
issue: https://github.com/elastic/elasticsearch/issues/127787
459+
- class: org.elasticsearch.xpack.esql.action.CrossClusterQueryWithFiltersIT
460+
method: testTimestampFilterFromQuery
461+
issue: https://github.com/elastic/elasticsearch/issues/127332
462+
- class: org.elasticsearch.indices.stats.IndexStatsIT
463+
method: testThrottleStats
464+
issue: https://github.com/elastic/elasticsearch/issues/126359
465+
- class: org.elasticsearch.xpack.esql.expression.function.aggregate.SampleTests
466+
method: testGroupingAggregate {TestCase=<long unicode KEYWORDs>}
467+
issue: https://github.com/elastic/elasticsearch/issues/127950
468+
- class: org.elasticsearch.xpack.esql.expression.function.aggregate.SampleTests
469+
method: testGroupingAggregate {TestCase=<long unicode TEXTs>}
470+
issue: https://github.com/elastic/elasticsearch/issues/127951
465471

466472
# Examples:
467473
#

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ static TransportVersion def(int id) {
7676
* READ THE COMMENT BELOW THIS BLOCK OF DECLARATIONS BEFORE ADDING NEW TRANSPORT VERSIONS
7777
* Detached transport versions added below here.
7878
*/
79-
public static final TransportVersion V_8_9_X = def(8_500_020);
80-
public static final TransportVersion V_8_10_X = def(8_500_061);
79+
public static final TransportVersion V_8_9_X = def(8_500_0_20);
80+
public static final TransportVersion V_8_10_X = def(8_500_0_61);
8181
public static final TransportVersion V_8_11_X = def(8_512_0_01);
8282
public static final TransportVersion V_8_12_0 = def(8_560_0_00);
8383
public static final TransportVersion V_8_12_1 = def(8_560_0_01);
@@ -242,16 +242,17 @@ static TransportVersion def(int id) {
242242
public static final TransportVersion RANDOM_SAMPLER_QUERY_BUILDER = def(9_063_0_00);
243243
public static final TransportVersion SETTINGS_IN_DATA_STREAMS = def(9_064_0_00);
244244
public static final TransportVersion INTRODUCE_FAILURES_LIFECYCLE = def(9_065_0_00);
245-
public static final TransportVersion PROJECT_METADATA_SETTINGS = def(9_066_00_0);
246-
public static final TransportVersion AGGREGATE_METRIC_DOUBLE_BLOCK = def(9_067_00_0);
245+
public static final TransportVersion PROJECT_METADATA_SETTINGS = def(9_066_0_00);
246+
public static final TransportVersion AGGREGATE_METRIC_DOUBLE_BLOCK = def(9_067_0_00);
247247
public static final TransportVersion PINNED_RETRIEVER = def(9_068_0_00);
248248
public static final TransportVersion ML_INFERENCE_SAGEMAKER = def(9_069_0_00);
249-
public static final TransportVersion WRITE_LOAD_INCLUDES_BUFFER_WRITES = def(9_070_00_0);
249+
public static final TransportVersion WRITE_LOAD_INCLUDES_BUFFER_WRITES = def(9_070_0_00);
250250
public static final TransportVersion INTRODUCE_FAILURES_DEFAULT_RETENTION = def(9_071_0_00);
251251
public static final TransportVersion FILE_SETTINGS_HEALTH_INFO = def(9_072_0_00);
252252
public static final TransportVersion FIELD_CAPS_ADD_CLUSTER_ALIAS = def(9_073_0_00);
253-
public static final TransportVersion INFERENCE_ADD_TIMEOUT_PUT_ENDPOINT = def(9_074_00_0);
254-
public static final TransportVersion ESQL_FIELD_ATTRIBUTE_DROP_TYPE = def(9_075_00_0);
253+
public static final TransportVersion INFERENCE_ADD_TIMEOUT_PUT_ENDPOINT = def(9_074_0_00);
254+
public static final TransportVersion ESQL_FIELD_ATTRIBUTE_DROP_TYPE = def(9_075_0_00);
255+
public static final TransportVersion ESQL_TIME_SERIES_SOURCE_STATUS = def(9_076_0_00);
255256

256257
/*
257258
* STOP! READ THIS FIRST! No, really,

0 commit comments

Comments
 (0)