Skip to content

Commit 96ab1e1

Browse files
authored
Merge branch '9.0' into backport/9.0/pr-123689
2 parents 9cdc219 + e540f86 commit 96ab1e1

File tree

16 files changed

+173
-106
lines changed

16 files changed

+173
-106
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ private String getPath() {
111111
List<String> classNames() throws IOException {
112112
Pattern classEnding = Pattern.compile(".*\\.class$");
113113
try (JarFile jf = new JarFile(this.path)) {
114-
return jf.stream().map(ZipEntry::getName).filter(classEnding.asMatchPredicate()).collect(Collectors.toList());
114+
return jf.stream()
115+
.map(ZipEntry::getName)
116+
.filter(classEnding.asMatchPredicate())
117+
.filter(c -> c.startsWith("org/elasticsearch/logging/internal/") == false)
118+
.collect(Collectors.toList());
115119
}
116120
}
117121

build-tools-internal/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ opensaml = 4.3.0
2929

3030
# client dependencies
3131
httpclient = 4.5.14
32-
httpcore = 4.4.13
32+
httpcore = 4.4.16
3333
httpasyncclient = 4.1.5
3434
commonslogging = 1.2
3535
commonscodec = 1.15

gradle/build.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ docker-compose = "com.avast.gradle:gradle-docker-compose-plugin:0.17.5"
1919
forbiddenApis = "de.thetaphi:forbiddenapis:3.8"
2020
gradle-enterprise = "com.gradle:develocity-gradle-plugin:3.18.1"
2121
hamcrest = "org.hamcrest:hamcrest:2.1"
22-
httpcore = "org.apache.httpcomponents:httpcore:4.4.12"
22+
httpcore = "org.apache.httpcomponents:httpcore:4.4.16"
2323
httpclient = "org.apache.httpcomponents:httpclient:4.5.14"
2424
idea-ext = "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.4"
2525
javaparser = "com.github.javaparser:javaparser-core:3.18.0"

gradle/verification-metadata.xml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,11 +2598,6 @@
25982598
<sha256 value="5324d2cbc2d311c9f91b82bcbc746ec2a29f1f5b744395a50ff3afb873db1cee" origin="Generated by Gradle"/>
25992599
</artifact>
26002600
</component>
2601-
<component group="org.apache.httpcomponents" name="httpcore" version="4.4.12">
2602-
<artifact name="httpcore-4.4.12.jar">
2603-
<sha256 value="ab765334beabf0ea024484a5e90a7c40e8160b145f22d199e11e27f68d57da08" origin="Generated by Gradle"/>
2604-
</artifact>
2605-
</component>
26062601
<component group="org.apache.httpcomponents" name="httpcore" version="4.4.13">
26072602
<artifact name="httpcore-4.4.13.jar">
26082603
<sha256 value="e06e89d40943245fcfa39ec537cdbfce3762aecde8f9c597780d2b00c2b43424" origin="Generated by Gradle"/>
@@ -2618,9 +2613,9 @@
26182613
<sha256 value="f7bc09dc8a7003822d109634ffd3845d579d12e725ae54673e323a7ce7f5e325" origin="Generated by Gradle"/>
26192614
</artifact>
26202615
</component>
2621-
<component group="org.apache.httpcomponents" name="httpcore-nio" version="4.4.13">
2622-
<artifact name="httpcore-nio-4.4.13.jar">
2623-
<sha256 value="71fcfbe869002c48563cc5979fc734571c8d0d167ccce42970c932f337981f19" origin="Generated by Gradle"/>
2616+
<component group="org.apache.httpcomponents" name="httpcore-nio" version="4.4.16">
2617+
<artifact name="httpcore-nio-4.4.16.jar">
2618+
<sha256 value="4018736ede2d321034e8517ea90baefb31831a8608afccc446d8a699fb1d00d4" origin="Generated by Gradle"/>
26242619
</artifact>
26252620
</component>
26262621
<component group="org.apache.james" name="apache-mime4j-core" version="0.8.11">

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTree.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ private FileAccessTree(
138138
});
139139
}
140140

141-
// everything has access to the temp dir and the jdk
141+
// everything has access to the temp dir, config dir and the jdk
142142
addPathAndMaybeLink.accept(pathLookup.tempDir(), Mode.READ_WRITE);
143+
// TODO: this grants read access to the config dir for all modules until explicit read entitlements can be added
144+
addPathAndMaybeLink.accept(pathLookup.configDir(), Mode.READ);
143145

144146
// TODO: watcher uses javax.activation which looks for known mime types configuration, should this be global or explicit in watcher?
145147
Path jdk = Paths.get(System.getProperty("java.home"));

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTreeTests.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void testPathAndFileWithSamePrefix() {
136136
}
137137

138138
public void testReadWithRelativePath() {
139-
for (var dir : List.of("config", "home")) {
139+
for (var dir : List.of("home")) {
140140
var tree = accessTree(entitlement(Map.of("relative_path", "foo", "mode", "read", "relative_to", dir)), List.of());
141141
assertThat(tree.canRead(path("foo")), is(false));
142142

@@ -153,7 +153,7 @@ public void testReadWithRelativePath() {
153153
}
154154

155155
public void testWriteWithRelativePath() {
156-
for (var dir : List.of("config", "home")) {
156+
for (var dir : List.of("home")) {
157157
var tree = accessTree(entitlement(Map.of("relative_path", "foo", "mode", "read_write", "relative_to", dir)), List.of());
158158
assertThat(tree.canWrite(path("/" + dir + "/foo")), is(true));
159159
assertThat(tree.canWrite(path("/" + dir + "/foo/subdir")), is(true));
@@ -289,6 +289,12 @@ public void testTempDirAccess() {
289289
assertThat(tree.canWrite(TEST_PATH_LOOKUP.tempDir()), is(true));
290290
}
291291

292+
public void testConfigDirAccess() {
293+
var tree = FileAccessTree.of("test-component", "test-module", FilesEntitlement.EMPTY, TEST_PATH_LOOKUP, List.of());
294+
assertThat(tree.canRead(TEST_PATH_LOOKUP.configDir()), is(true));
295+
assertThat(tree.canWrite(TEST_PATH_LOOKUP.configDir()), is(false));
296+
}
297+
292298
public void testBasicExclusiveAccess() {
293299
var tree = accessTree(entitlement("foo", "read"), exclusivePaths("test-component", "test-module", "foo"));
294300
assertThat(tree.canRead(path("foo")), is(true));

server/src/main/java/org/elasticsearch/search/fetch/StoredFieldsSpec.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,17 @@ public StoredFieldsSpec merge(StoredFieldsSpec other) {
4242
if (this == other) {
4343
return this;
4444
}
45-
Set<String> mergedFields = new HashSet<>(this.requiredStoredFields);
46-
mergedFields.addAll(other.requiredStoredFields);
45+
Set<String> mergedFields;
46+
if (other.requiredStoredFields.isEmpty()) {
47+
/*
48+
* In the very very common case that we don't need new stored fields
49+
* let's not clone the existing array.
50+
*/
51+
mergedFields = this.requiredStoredFields;
52+
} else {
53+
mergedFields = new HashSet<>(this.requiredStoredFields);
54+
mergedFields.addAll(other.requiredStoredFields);
55+
}
4756
return new StoredFieldsSpec(
4857
this.requiresSource || other.requiresSource,
4958
this.requiresMetadata || other.requiresMetadata,

server/src/test/java/org/elasticsearch/common/logging/HeaderWarningTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ public void testAddComplexWarning() {
315315
+ "profiling-symbols,synthetics] with patterns (.deprecation-indexing-template => [.logs-deprecation.*],"
316316
+ ".fleet-file-data => [.fleet-file-data-*-*],.fleet-files => [.fleet-files-*-*],.ml-anomalies- => [.ml-anomalies-*],"
317317
+ ".ml-notifications-000002 => [.ml-notifications-000002],.ml-state => [.ml-state*],.ml-stats => [.ml-stats-*],"
318-
+ ".monitoring-beats-mb => [.monitoring-beats-8-*],.monitoring-ent-search-mb => [.monitoring-ent-search-8-*],"
319-
+ ".monitoring-es-mb => [.monitoring-es-8-*],.monitoring-kibana-mb => [.monitoring-kibana-8-*],"
320-
+ ".monitoring-logstash-mb => [.monitoring-logstash-8-*],.profiling-ilm-lock => [.profiling-ilm-lock*],"
318+
+ ".monitoring-beats-mb => [.monitoring-beats-9-*],.monitoring-ent-search-mb => [.monitoring-ent-search-8-*],"
319+
+ ".monitoring-es-mb => [.monitoring-es-9-*],.monitoring-kibana-mb => [.monitoring-kibana-9-*],"
320+
+ ".monitoring-logstash-mb => [.monitoring-logstash-9-*],.profiling-ilm-lock => [.profiling-ilm-lock*],"
321321
+ ".slm-history => [.slm-history-7*],.watch-history-16 => [.watcher-history-16*],"
322322
+ "behavioral_analytics-events-default => [behavioral_analytics-events-*],ilm-history => [ilm-history-7*],"
323323
+ "logs => [logs-*-*],metrics => [metrics-*-*],profiling-events => [profiling-events*],profiling-executables => "

server/src/test/java/org/elasticsearch/search/fetch/StoredFieldsSpecTests.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
import org.elasticsearch.search.internal.SearchContext;
1919
import org.elasticsearch.test.ESTestCase;
2020

21+
import java.util.Set;
22+
2123
import static org.hamcrest.Matchers.hasSize;
24+
import static org.hamcrest.Matchers.sameInstance;
2225
import static org.mockito.Mockito.mock;
2326
import static org.mockito.Mockito.when;
2427

@@ -67,6 +70,17 @@ public void testScriptFieldsEnableMetadata() {
6770
assertTrue(spec.requiresMetadata());
6871
}
6972

73+
public void testNoCloneOnMerge() {
74+
StoredFieldsSpec spec = StoredFieldsSpec.NO_REQUIREMENTS;
75+
spec = spec.merge(StoredFieldsSpec.NEEDS_SOURCE);
76+
assertThat(spec.requiredStoredFields(), sameInstance(StoredFieldsSpec.NO_REQUIREMENTS.requiredStoredFields()));
77+
78+
StoredFieldsSpec needsCat = new StoredFieldsSpec(false, false, Set.of("cat"));
79+
StoredFieldsSpec withCat = spec.merge(needsCat);
80+
spec = withCat.merge(StoredFieldsSpec.NO_REQUIREMENTS);
81+
assertThat(spec.requiredStoredFields(), sameInstance(withCat.requiredStoredFields()));
82+
}
83+
7084
private static SearchContext searchContext(SearchSourceBuilder sourceBuilder) {
7185
SearchContext sc = mock(SearchContext.class);
7286
when(sc.fetchSourceContext()).thenReturn(sourceBuilder.fetchSource());

x-pack/plugin/core/template-resources/src/main/resources/monitoring-ent-search-mb.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"index_patterns": [".monitoring-ent-search-${xpack.stack.monitoring.template.version}-*"],
2+
"index_patterns": [".monitoring-ent-search-8-*"],
33
"version": ${xpack.stack.monitoring.template.release.version},
44
"_meta": {
55
"description": "Template used by Enterprise Search Metricbeat module monitoring information for Stack Monitoring",

0 commit comments

Comments
 (0)