Skip to content

Commit 3ce802a

Browse files
Merge remote-tracking branch 'elastic/main' into batched-exec-short
2 parents cec0c0f + 6e6e42f commit 3ce802a

File tree

16 files changed

+134
-72
lines changed

16 files changed

+134
-72
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public class ElasticsearchJavaBasePlugin implements Plugin<Project> {
5858

5959
@Override
6060
public void apply(Project project) {
61-
project.getRootProject().getPlugins().apply(GlobalBuildInfoPlugin.class);
6261
// make sure the global build info plugin is applied to the root project
6362
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
6463
buildParams = project.getRootProject().getExtensions().getByType(BuildParameterExtension.class);

docs/changelog/122047.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

libs/entitlement/asm-provider/src/main/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImpl.java

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ public InstrumentationInfo lookupImplementationMethod(
118118
) throws NoSuchMethodException, ClassNotFoundException {
119119

120120
var targetMethod = targetSuperclass.getDeclaredMethod(methodName, parameterTypes);
121-
validateTargetMethod(implementationClass, targetMethod);
121+
var implementationMethod = implementationClass.getMethod(targetMethod.getName(), targetMethod.getParameterTypes());
122+
validateTargetMethod(implementationClass, targetMethod, implementationMethod);
122123

123124
var checkerAdditionalArguments = Stream.of(Class.class, targetSuperclass);
124125
var checkMethodArgumentTypes = Stream.concat(checkerAdditionalArguments, Arrays.stream(parameterTypes))
@@ -169,15 +170,15 @@ public MethodVisitor visitMethod(
169170

170171
return new InstrumentationInfo(
171172
new MethodKey(
172-
Type.getInternalName(implementationClass),
173-
targetMethod.getName(),
173+
Type.getInternalName(implementationMethod.getDeclaringClass()),
174+
implementationMethod.getName(),
174175
Arrays.stream(parameterTypes).map(c -> Type.getType(c).getInternalName()).toList()
175176
),
176177
checkMethod[0]
177178
);
178179
}
179180

180-
private static void validateTargetMethod(Class<?> implementationClass, Method targetMethod) {
181+
private static void validateTargetMethod(Class<?> implementationClass, Method targetMethod, Method implementationMethod) {
181182
if (targetMethod.getDeclaringClass().isAssignableFrom(implementationClass) == false) {
182183
throw new IllegalArgumentException(
183184
String.format(
@@ -209,37 +210,26 @@ private static void validateTargetMethod(Class<?> implementationClass, Method ta
209210
)
210211
);
211212
}
212-
try {
213-
var implementationMethod = implementationClass.getMethod(targetMethod.getName(), targetMethod.getParameterTypes());
214-
var methodModifiers = implementationMethod.getModifiers();
215-
if (Modifier.isAbstract(methodModifiers)) {
216-
throw new IllegalArgumentException(
217-
String.format(
218-
Locale.ROOT,
219-
"Not a valid instrumentation method: %s is abstract in %s",
220-
targetMethod.getName(),
221-
implementationClass.getName()
222-
)
223-
);
224-
}
225-
if (Modifier.isPublic(methodModifiers) == false) {
226-
throw new IllegalArgumentException(
227-
String.format(
228-
Locale.ROOT,
229-
"Not a valid instrumentation method: %s is not public in %s",
230-
targetMethod.getName(),
231-
implementationClass.getName()
232-
)
233-
);
234-
}
235-
} catch (NoSuchMethodException e) {
236-
assert false
237-
: String.format(
213+
var methodModifiers = implementationMethod.getModifiers();
214+
if (Modifier.isAbstract(methodModifiers)) {
215+
throw new IllegalArgumentException(
216+
String.format(
238217
Locale.ROOT,
239-
"Not a valid instrumentation method: %s cannot be found in %s",
218+
"Not a valid instrumentation method: %s is abstract in %s",
240219
targetMethod.getName(),
241220
implementationClass.getName()
242-
);
221+
)
222+
);
223+
}
224+
if (Modifier.isPublic(methodModifiers) == false) {
225+
throw new IllegalArgumentException(
226+
String.format(
227+
Locale.ROOT,
228+
"Not a valid instrumentation method: %s is not public in %s",
229+
targetMethod.getName(),
230+
implementationClass.getName()
231+
)
232+
);
243233
}
244234
}
245235

libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImplTests.java

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,16 @@ public void instanceMethod(int x, String y) {}
4040

4141
abstract static class TestTargetBaseClass {
4242
abstract void instanceMethod(int x, String y);
43+
44+
abstract void instanceMethod2(int x, String y);
4345
}
4446

45-
static class TestTargetImplementationClass extends TestTargetBaseClass {
47+
abstract static class TestTargetIntermediateClass extends TestTargetBaseClass {
48+
@Override
49+
public void instanceMethod2(int x, String y) {}
50+
}
51+
52+
static class TestTargetImplementationClass extends TestTargetIntermediateClass {
4653
@Override
4754
public void instanceMethod(int x, String y) {}
4855
}
@@ -364,6 +371,44 @@ public void testLookupImplementationMethodWithBaseClass() throws ClassNotFoundEx
364371
);
365372
}
366373

374+
public void testLookupImplementationMethodWithInheritance() throws ClassNotFoundException, NoSuchMethodException {
375+
var info = instrumentationService.lookupImplementationMethod(
376+
TestTargetBaseClass.class,
377+
"instanceMethod2",
378+
TestTargetImplementationClass.class,
379+
TestCheckerMixed.class,
380+
"checkInstanceMethodManual",
381+
int.class,
382+
String.class
383+
);
384+
385+
assertThat(
386+
info.targetMethod(),
387+
equalTo(
388+
new MethodKey(
389+
"org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImplTests$TestTargetIntermediateClass",
390+
"instanceMethod2",
391+
List.of("I", "java/lang/String")
392+
)
393+
)
394+
);
395+
assertThat(
396+
info.checkMethod(),
397+
equalTo(
398+
new CheckMethod(
399+
"org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImplTests$TestCheckerMixed",
400+
"checkInstanceMethodManual",
401+
List.of(
402+
"Ljava/lang/Class;",
403+
"Lorg/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImplTests$TestTargetBaseClass;",
404+
"I",
405+
"Ljava/lang/String;"
406+
)
407+
)
408+
)
409+
);
410+
}
411+
367412
public void testParseCheckerMethodSignatureStaticMethod() {
368413
var methodKey = InstrumentationServiceImpl.parseCheckerMethodSignature(
369414
"check$org_example_TestClass$$staticMethod",

muted-tests.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,6 @@ tests:
353353
- class: org.elasticsearch.search.CrossClusterSearchUnavailableClusterIT
354354
method: testSearchSkipUnavailable
355355
issue: https://github.com/elastic/elasticsearch/issues/121497
356-
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
357-
issue: https://github.com/elastic/elasticsearch/issues/121411
358356
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
359357
method: test {yaml=reference/cat/health/cat-health-no-timestamp-example}
360358
issue: https://github.com/elastic/elasticsearch/issues/121867
@@ -383,8 +381,6 @@ tests:
383381
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
384382
method: testWithOnlyTrainingRowsAndTrainingPercentIsFifty_DependentVariableIsBoolean
385383
issue: https://github.com/elastic/elasticsearch/issues/121680
386-
- class: org.elasticsearch.xpack.esql.qa.single_node.EsqlSpecIT
387-
issue: https://github.com/elastic/elasticsearch/issues/121411
388384
- class: org.elasticsearch.xpack.downsample.DownsampleActionSingleNodeTests
389385
method: testDuplicateDownsampleRequest
390386
issue: https://github.com/elastic/elasticsearch/issues/122158
@@ -411,6 +407,11 @@ tests:
411407
- class: org.elasticsearch.xpack.security.authz.IndexAliasesTests
412408
method: testRemoveIndex
413409
issue: https://github.com/elastic/elasticsearch/issues/122221
410+
- class: org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT
411+
issue: https://github.com/elastic/elasticsearch/issues/121737
412+
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
413+
method: testGroupingMultiValueByOrdinals
414+
issue: https://github.com/elastic/elasticsearch/issues/122228
414415

415416
# Examples:
416417
#

server/src/internalClusterTest/java/org/elasticsearch/snapshots/RepositoriesIT.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,6 @@ public void taskSucceeded(ClusterStateTaskListener clusterStateTaskListener, Obj
508508
.orElseThrow()
509509
.queue();
510510

511-
// There is one task in the queue for computing and forking the cleanup work.
512-
assertThat(queueLength.getAsInt(), equalTo(1));
513-
514-
safeAwait(barrier); // unblock the barrier thread and let it process the queue
515-
safeAwait(barrier); // wait for the queue to be processed
516-
517511
// There are indexCount (=3*snapshotPoolSize) index-deletion tasks, plus one for cleaning up the root metadata. However, the
518512
// throttled runner only enqueues one task per SNAPSHOT thread to start with, and then the eager runner adds another one. This shows
519513
// we are not spamming the threadpool with all the tasks at once, which means that other snapshot activities can run alongside this

server/src/main/java/org/elasticsearch/repositories/RepositoryData.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.elasticsearch.snapshots.SnapshotInfo;
3030
import org.elasticsearch.snapshots.SnapshotState;
3131
import org.elasticsearch.snapshots.SnapshotsService;
32-
import org.elasticsearch.threadpool.ThreadPool;
3332
import org.elasticsearch.xcontent.XContentBuilder;
3433
import org.elasticsearch.xcontent.XContentParser;
3534

@@ -378,7 +377,6 @@ private static boolean isIndexToUpdateAfterRemovingSnapshots(
378377
* @return map of index to index metadata blob id to delete
379378
*/
380379
public Map<IndexId, Collection<String>> indexMetaDataToRemoveAfterRemovingSnapshots(Collection<SnapshotId> snapshotIds) {
381-
assert ThreadPool.assertCurrentThreadPool(ThreadPool.Names.SNAPSHOT);
382380
Iterator<IndexId> indicesForSnapshot = indicesToUpdateAfterRemovingSnapshot(snapshotIds);
383381
final Set<String> allRemainingIdentifiers = indexMetaDataGenerations.lookup.entrySet()
384382
.stream()

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,20 +1134,14 @@ private void runWithUniqueShardMetadataNaming(ActionListener<RepositoryData> rep
11341134
);
11351135
})
11361136

1137-
.<RepositoryData>andThen(
1138-
// writeIndexGen finishes on master-service thread so must fork here.
1139-
snapshotExecutor,
1140-
threadPool.getThreadContext(),
1141-
(l, newRepositoryData) -> {
1142-
l.onResponse(newRepositoryData);
1143-
// Once we have updated the repository, run the unreferenced blobs cleanup in parallel to shard-level snapshot
1144-
// deletion
1145-
try (var refs = new RefCountingRunnable(onCompletion)) {
1146-
cleanupUnlinkedRootAndIndicesBlobs(newRepositoryData, refs.acquireListener());
1147-
cleanupUnlinkedShardLevelBlobs(refs.acquireListener());
1148-
}
1137+
.<RepositoryData>andThen((l, newRepositoryData) -> {
1138+
l.onResponse(newRepositoryData);
1139+
// Once we have updated the repository, run the unreferenced blobs cleanup in parallel to shard-level snapshot deletion
1140+
try (var refs = new RefCountingRunnable(onCompletion)) {
1141+
cleanupUnlinkedRootAndIndicesBlobs(newRepositoryData, refs.acquireListener());
1142+
cleanupUnlinkedShardLevelBlobs(refs.acquireListener());
11491143
}
1150-
)
1144+
})
11511145

11521146
.addListener(repositoryDataUpdateListener);
11531147
}

x-pack/plugin/esql/qa/server/mixed-cluster/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/mixed/MixedClusterEsqlSpecIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ protected void shouldSkipTest(String testName) throws IOException {
7070
assumeTrue("Test " + testName + " is skipped on " + bwcVersion, isEnabled(testName, instructions, bwcVersion));
7171
}
7272

73+
@Override
74+
protected boolean shouldSkipTestsWithSemanticTextFields() {
75+
return true;
76+
}
77+
7378
@Override
7479
protected boolean enableRoundingDoubleValuesOnAsserting() {
7580
return true;

x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ protected void shouldSkipTest(String testName) throws IOException {
127127
assumeFalse("LOOKUP JOIN not yet supported in CCS", testCase.requiredCapabilities.contains(JOIN_LOOKUP_V12.capabilityName()));
128128
}
129129

130+
@Override
131+
protected boolean shouldSkipTestsWithSemanticTextFields() {
132+
return true;
133+
}
134+
130135
private TestFeatureService remoteFeaturesService() throws IOException {
131136
if (remoteFeaturesService == null) {
132137
var remoteNodeVersions = readVersionsFromNodesInfo(remoteClusterClient());

0 commit comments

Comments
 (0)