Skip to content

Commit f1e7ed8

Browse files
committed
Merge branch 'main' into esql-telemetry
2 parents fce04d5 + 43e6fad commit f1e7ed8

File tree

36 files changed

+609
-178
lines changed

36 files changed

+609
-178
lines changed

build-tools-internal/src/main/groovy/elasticsearch.ide.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
166166
tasks.register('buildDependencyArtifacts') {
167167
group = 'ide'
168168
description = 'Builds artifacts needed as dependency for IDE modules'
169-
dependsOn([':plugins:repository-hdfs:hadoop-client-api:shadowJar',
169+
dependsOn([':plugins:repository-hdfs:hadoop-client-api:jar',
170170
':x-pack:plugin:esql:compute:ann:jar',
171171
':x-pack:plugin:esql:compute:gen:jar',
172172
':server:generateModulesList',

docs/changelog/116868.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 116868
2+
summary: Run `TransportGetComponentTemplateAction` on local node
3+
area: Indices APIs
4+
type: enhancement
5+
issues: []

docs/changelog/117214.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 117214
2+
summary: Returning ignored fields in the simulate ingest API
3+
area: Ingest Node
4+
type: enhancement
5+
issues: []

docs/changelog/119134.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 119134
2+
summary: Handle `index.mapping.ignore_malformed` in downsampling
3+
area: Downsampling
4+
type: bug
5+
issues:
6+
- 119075

docs/reference/indices/get-component-template.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Wildcard (`*`) expressions are supported.
6767

6868
include::{docdir}/rest-api/common-parms.asciidoc[tag=flat-settings]
6969

70-
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
70+
include::{docdir}/rest-api/common-parms.asciidoc[tag=local-deprecated-9.0.0]
7171

7272
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
7373

docs/reference/rest-api/common-parms.asciidoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,16 @@ node only. Defaults to `false`, which means information is retrieved from
668668
the master node.
669669
end::local[]
670670

671+
tag::local-deprecated-9.0.0[]
672+
`local`::
673+
(Optional, Boolean) If `true`, the request retrieves information from the local
674+
node only. Defaults to `false`, which means information is retrieved from
675+
the master node.
676+
+
677+
deprecated::[9.0.0, "The `?local` query parameter to this API has no effect, is now deprecated, and will be removed in a future version."]
678+
679+
end::local-deprecated-9.0.0[]
680+
671681
tag::mappings[]
672682
`mappings`::
673683
+

plugins/repository-hdfs/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ configurations {
2828
}
2929

3030
dependencies {
31-
api project(path: 'hadoop-client-api', configuration: 'shadow')
31+
api project(path: 'hadoop-client-api', configuration: 'default')
3232
if (isEclipse) {
3333
/*
3434
* Eclipse can't pick up the shadow dependency so we point it at *something*
Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
1-
apply plugin: 'elasticsearch.build'
2-
apply plugin: 'com.gradleup.shadow'
1+
apply plugin: 'elasticsearch.java'
2+
3+
sourceSets {
4+
patcher
5+
}
6+
7+
configurations {
8+
thejar {
9+
canBeResolved = true
10+
}
11+
}
312

413
dependencies {
5-
implementation "org.apache.hadoop:hadoop-client-api:${project.parent.versions.hadoop}"
14+
thejar("org.apache.hadoop:hadoop-client-api:${project.parent.versions.hadoop}") {
15+
transitive = false
16+
}
17+
18+
patcherImplementation 'org.ow2.asm:asm:9.7.1'
19+
patcherImplementation 'org.ow2.asm:asm-tree:9.7.1'
620
}
721

8-
tasks.named('shadowJar').configure {
9-
exclude 'org/apache/hadoop/util/ShutdownHookManager$*.class'
22+
def outputDir = layout.buildDirectory.dir("patched-classes")
23+
24+
def patchTask = tasks.register("patchClasses", JavaExec) {
25+
inputs.files(configurations.thejar).withPathSensitivity(PathSensitivity.RELATIVE)
26+
inputs.files(sourceSets.patcher.output).withPathSensitivity(PathSensitivity.RELATIVE)
27+
outputs.dir(outputDir)
28+
classpath = sourceSets.patcher.runtimeClasspath
29+
mainClass = 'org.elasticsearch.hdfs.patch.HdfsClassPatcher'
30+
doFirst {
31+
args(configurations.thejar.singleFile, outputDir.get().asFile)
32+
}
1033
}
1134

12-
['jarHell', 'thirdPartyAudit', 'forbiddenApisMain', 'splitPackagesAudit'].each {
13-
tasks.named(it).configure {
14-
enabled = false
35+
tasks.named('jar').configure {
36+
dependsOn(configurations.thejar)
37+
38+
from(patchTask)
39+
from({ project.zipTree(configurations.thejar.singleFile) }) {
40+
eachFile {
41+
if (outputDir.get().file(it.relativePath.pathString).asFile.exists()) {
42+
it.exclude()
43+
}
44+
}
1545
}
1646
}

plugins/repository-hdfs/hadoop-client-api/src/main/java/org/apache/hadoop/util/ShutdownHookManager.java

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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.hdfs.patch;
11+
12+
import org.objectweb.asm.ClassReader;
13+
import org.objectweb.asm.ClassVisitor;
14+
import org.objectweb.asm.ClassWriter;
15+
16+
import java.io.File;
17+
import java.nio.file.Files;
18+
import java.nio.file.Path;
19+
import java.nio.file.Paths;
20+
import java.util.Map;
21+
import java.util.function.Function;
22+
import java.util.jar.JarEntry;
23+
import java.util.jar.JarFile;
24+
25+
public class HdfsClassPatcher {
26+
static final Map<String, Function<ClassWriter, ClassVisitor>> patchers = Map.of(
27+
"org/apache/hadoop/util/ShutdownHookManager.class",
28+
ShutdownHookManagerPatcher::new,
29+
"org/apache/hadoop/util/Shell.class",
30+
ShellPatcher::new
31+
);
32+
33+
public static void main(String[] args) throws Exception {
34+
String jarPath = args[0];
35+
Path outputDir = Paths.get(args[1]);
36+
37+
try (JarFile jarFile = new JarFile(new File(jarPath))) {
38+
for (var patcher : patchers.entrySet()) {
39+
JarEntry jarEntry = jarFile.getJarEntry(patcher.getKey());
40+
if (jarEntry == null) {
41+
throw new IllegalArgumentException("path [" + patcher.getKey() + "] not found in [" + jarPath + "]");
42+
}
43+
byte[] classToPatch = jarFile.getInputStream(jarEntry).readAllBytes();
44+
45+
ClassReader classReader = new ClassReader(classToPatch);
46+
ClassWriter classWriter = new ClassWriter(classReader, 0);
47+
classReader.accept(patcher.getValue().apply(classWriter), 0);
48+
49+
Path outputFile = outputDir.resolve(patcher.getKey());
50+
Files.createDirectories(outputFile.getParent());
51+
Files.write(outputFile, classWriter.toByteArray());
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)