Skip to content

Commit 5aa4f46

Browse files
committed
Merge branch 'check-array-size-at-parse-time' of github.com:drempapis/elasticsearch into check-array-size-at-parse-time
2 parents 6f301f5 + bbb9340 commit 5aa4f46

File tree

134 files changed

+3935
-540
lines changed

Some content is hidden

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

134 files changed

+3935
-540
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/ValuesSourceReaderBenchmark.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.elasticsearch.compute.data.LongVector;
4141
import org.elasticsearch.compute.data.Page;
4242
import org.elasticsearch.compute.lucene.LuceneSourceOperator;
43+
import org.elasticsearch.compute.lucene.ShardRefCounted;
4344
import org.elasticsearch.compute.lucene.ValuesSourceReaderOperator;
4445
import org.elasticsearch.compute.operator.topn.TopNOperator;
4546
import org.elasticsearch.core.IOUtils;
@@ -477,6 +478,7 @@ private void setupPages() {
477478
pages.add(
478479
new Page(
479480
new DocVector(
481+
ShardRefCounted.ALWAYS_REFERENCED,
480482
blockFactory.newConstantIntBlockWith(0, end - begin).asVector(),
481483
blockFactory.newConstantIntBlockWith(ctx.ord, end - begin).asVector(),
482484
docs.build(),
@@ -512,7 +514,14 @@ record ItrAndOrd(PrimitiveIterator.OfInt itr, int ord) {}
512514
if (size >= BLOCK_LENGTH) {
513515
pages.add(
514516
new Page(
515-
new DocVector(blockFactory.newConstantIntVector(0, size), leafs.build(), docs.build(), null).asBlock()
517+
new DocVector(
518+
519+
ShardRefCounted.ALWAYS_REFERENCED,
520+
blockFactory.newConstantIntVector(0, size),
521+
leafs.build(),
522+
docs.build(),
523+
null
524+
).asBlock()
516525
)
517526
);
518527
docs = blockFactory.newIntVectorBuilder(BLOCK_LENGTH);
@@ -525,6 +534,8 @@ record ItrAndOrd(PrimitiveIterator.OfInt itr, int ord) {}
525534
pages.add(
526535
new Page(
527536
new DocVector(
537+
538+
ShardRefCounted.ALWAYS_REFERENCED,
528539
blockFactory.newConstantIntBlockWith(0, size).asVector(),
529540
leafs.build().asBlock().asVector(),
530541
docs.build(),
@@ -551,6 +562,8 @@ record ItrAndOrd(PrimitiveIterator.OfInt itr, int ord) {}
551562
pages.add(
552563
new Page(
553564
new DocVector(
565+
566+
ShardRefCounted.ALWAYS_REFERENCED,
554567
blockFactory.newConstantIntVector(0, 1),
555568
blockFactory.newConstantIntVector(next.ord, 1),
556569
blockFactory.newConstantIntVector(next.itr.nextInt(), 1),

docs/changelog/129370.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pr: 129370
2+
summary: Avoid dropping aggregate groupings in local plans
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 129811
7+
- 128054

docs/changelog/129454.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129454
2+
summary: Aggressive release of shard contexts
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/130032.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pr: 130032
2+
summary: ES|QL cross-cluster querying is now generally available
3+
area: ES|QL
4+
type: feature
5+
issues: []
6+
highlight:
7+
title: ES|QL cross-cluster querying is now generally available
8+
body: |-
9+
The ES|QL Cross-Cluster querying feature has been in technical preview since 8.13.
10+
As of releases 8.19.0 and 9.1.0 this is now generally available.
11+
This feature allows you to run ES|QL queries across multiple clusters.
12+
notable: true

gradle/verification-metadata.xml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,16 +1153,16 @@
11531153
<sha256 value="88ac9fd1bb51f82bcc664cc1eb9c225c90dc4389d660231b4cc737bebfe7d0aa" origin="Generated by Gradle"/>
11541154
</artifact>
11551155
</component>
1156-
<component group="com.squareup.okhttp3" name="okhttp" version="4.11.0">
1157-
<artifact name="okhttp-4.11.0.jar">
1158-
<sha256 value="ee8f6bd6cd1257013d748330f4ca147638a9fbcb52fb388d5ac93cf53408745d" origin="Generated by Gradle"/>
1159-
</artifact>
1160-
</component>
11611156
<component group="com.squareup.okhttp3" name="logging-interceptor" version="4.12.0">
11621157
<artifact name="logging-interceptor-4.12.0.jar">
11631158
<sha256 value="f3e8d5f0903c250c2b55d2f47fcfe008e80634385da8385161c7a63aaed0c74c" origin="Generated by Gradle"/>
11641159
</artifact>
11651160
</component>
1161+
<component group="com.squareup.okhttp3" name="okhttp" version="4.11.0">
1162+
<artifact name="okhttp-4.11.0.jar">
1163+
<sha256 value="ee8f6bd6cd1257013d748330f4ca147638a9fbcb52fb388d5ac93cf53408745d" origin="Generated by Gradle"/>
1164+
</artifact>
1165+
</component>
11661166
<component group="com.squareup.okhttp3" name="okhttp" version="4.12.0">
11671167
<artifact name="okhttp-4.12.0.jar">
11681168
<sha256 value="b1050081b14bb7a3a7e55a4d3ef01b5dcfabc453b4573a4fc019767191d5f4e0" origin="Generated by Gradle"/>
@@ -4601,6 +4601,11 @@
46014601
<sha256 value="8cadd43ac5eb6d09de05faecca38b917a040bb9139c7edeb4cc81c740b713281" origin="Generated by Gradle"/>
46024602
</artifact>
46034603
</component>
4604+
<component group="org.ow2.asm" name="asm" version="9.8">
4605+
<artifact name="asm-9.8.jar">
4606+
<sha256 value="876eab6a83daecad5ca67eb9fcabb063c97b5aeb8cf1fca7a989ecde17522051" origin="Generated by Gradle"/>
4607+
</artifact>
4608+
</component>
46044609
<component group="org.ow2.asm" name="asm-analysis" version="7.2">
46054610
<artifact name="asm-analysis-7.2.jar">
46064611
<sha256 value="be922aae60ff1ff1768e8e6544a38a7f92bd0a6d6b0b9791f94955d1bd453de2" origin="Generated by Gradle"/>
@@ -4621,6 +4626,11 @@
46214626
<sha256 value="85b29371884ba31bb76edf22323c2c24e172c3267a67152eba3d1ccc2e041ef2" origin="Generated by Gradle"/>
46224627
</artifact>
46234628
</component>
4629+
<component group="org.ow2.asm" name="asm-analysis" version="9.8">
4630+
<artifact name="asm-analysis-9.8.jar">
4631+
<sha256 value="e640732fbcd3c6271925a504f125e38384688f4dfbbf92c8622dfcee0d09edb9" origin="Generated by Gradle"/>
4632+
</artifact>
4633+
</component>
46244634
<component group="org.ow2.asm" name="asm-commons" version="7.2">
46254635
<artifact name="asm-commons-7.2.jar">
46264636
<sha256 value="0e86b8b179c5fb223d1a880a0ff4960b6978223984b94e62e71135f2d8ea3558" origin="Generated by Gradle"/>
@@ -4686,6 +4696,11 @@
46864696
<sha256 value="9929881f59eb6b840e86d54570c77b59ce721d104e6dfd7a40978991c2d3b41f" origin="Generated by Gradle"/>
46874697
</artifact>
46884698
</component>
4699+
<component group="org.ow2.asm" name="asm-tree" version="9.8">
4700+
<artifact name="asm-tree-9.8.jar">
4701+
<sha256 value="14b7880cb7c85eed101e2710432fc3ffb83275532a6a894dc4c4095d49ad59f1" origin="Generated by Gradle"/>
4702+
</artifact>
4703+
</component>
46894704
<component group="org.ow2.asm" name="asm-util" version="7.2">
46904705
<artifact name="asm-util-7.2.jar">
46914706
<sha256 value="6e24913b021ffacfe8e7e053d6e0ccc731941148cfa078d4f1ed3d96904530f8" origin="Generated by Gradle"/>
@@ -4696,6 +4711,11 @@
46964711
<sha256 value="f885be71b5c90556f5f1ad1c4f9276b29b96057c497d46666fe4ddbec3cb43c6" origin="Generated by Gradle"/>
46974712
</artifact>
46984713
</component>
4714+
<component group="org.ow2.asm" name="asm-util" version="9.8">
4715+
<artifact name="asm-util-9.8.jar">
4716+
<sha256 value="8ba0460ecb28fd0e2980e5f3ef3433a513a457bc077f81a53bdc75b587a08d15" origin="Generated by Gradle"/>
4717+
</artifact>
4718+
</component>
46994719
<component group="org.reactivestreams" name="reactive-streams" version="1.0.4">
47004720
<artifact name="reactive-streams-1.0.4.jar">
47014721
<sha256 value="f75ca597789b3dac58f61857b9ac2e1034a68fa672db35055a8fb4509e325f28" origin="Generated by Gradle"/>

libs/core/src/main/java/org/elasticsearch/core/Releasables.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ public boolean equals(Object obj) {
202202
}
203203
}
204204

205+
/** Creates a {@link Releasable} that calls {@link RefCounted#decRef()} when closed. */
206+
public static Releasable fromRefCounted(RefCounted refCounted) {
207+
return () -> refCounted.decRef();
208+
}
209+
205210
private static class ReleaseOnce extends AtomicReference<Releasable> implements Releasable {
206211
ReleaseOnce(Releasable releasable) {
207212
super(releasable);

libs/entitlement/asm-provider/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ dependencies {
1313
compileOnly project(':libs:entitlement')
1414
compileOnly project(':libs:core')
1515
compileOnly project(':libs:logging')
16-
implementation 'org.ow2.asm:asm:9.7.1'
17-
implementation 'org.ow2.asm:asm-util:9.7.1'
18-
implementation 'org.ow2.asm:asm-tree:9.7.1'
19-
implementation 'org.ow2.asm:asm-analysis:9.7.1'
16+
implementation 'org.ow2.asm:asm:9.8'
17+
implementation 'org.ow2.asm:asm-util:9.8'
18+
implementation 'org.ow2.asm:asm-tree:9.8'
19+
implementation 'org.ow2.asm:asm-analysis:9.8'
2020
testImplementation project(":test:framework")
2121
testImplementation project(":libs:entitlement:bridge")
2222
}

libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ public static void bootstrap(
9898
);
9999
exportInitializationToAgent();
100100
loadAgent(findAgentJar(), EntitlementInitialization.class.getName());
101+
102+
if (EntitlementInitialization.getError() != null) {
103+
throw EntitlementInitialization.getError();
104+
}
101105
}
102106

103107
private static Path getUserHome() {

libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/DynamicInstrumentation.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ static void initialize(Instrumentation inst, Class<?> checkerInterface, boolean
117117
// We should have failed already in the loop above, but just in case we did not, rethrow.
118118
throw e;
119119
}
120+
121+
if (transformer.hadErrors()) {
122+
throw new RuntimeException("Failed to transform JDK classes for entitlements");
123+
}
120124
}
121125

122126
private static Map<MethodKey, CheckMethod> getMethodsToInstrument(Class<?> checkerInterface) throws ClassNotFoundException,

libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
import org.elasticsearch.entitlement.runtime.policy.PolicyChecker;
1717
import org.elasticsearch.entitlement.runtime.policy.PolicyCheckerImpl;
1818
import org.elasticsearch.entitlement.runtime.policy.PolicyManager;
19+
import org.elasticsearch.logging.LogManager;
20+
import org.elasticsearch.logging.Logger;
1921

2022
import java.lang.instrument.Instrumentation;
2123
import java.lang.reflect.Constructor;
2224
import java.lang.reflect.InvocationTargetException;
2325
import java.util.Set;
26+
import java.util.concurrent.atomic.AtomicReference;
2427

2528
import static java.util.Objects.requireNonNull;
2629

@@ -32,17 +35,26 @@
3235
* to begin injecting our instrumentation.
3336
*/
3437
public class EntitlementInitialization {
38+
private static final Logger logger = LogManager.getLogger(EntitlementInitialization.class);
3539

3640
private static final Module ENTITLEMENTS_MODULE = PolicyManager.class.getModule();
3741

3842
public static InitializeArgs initializeArgs;
3943
private static ElasticsearchEntitlementChecker checker;
44+
private static AtomicReference<RuntimeException> error = new AtomicReference<>();
4045

4146
// Note: referenced by bridge reflectively
4247
public static EntitlementChecker checker() {
4348
return checker;
4449
}
4550

51+
/**
52+
* Return any exception that occurred during initialization
53+
*/
54+
public static RuntimeException getError() {
55+
return error.get();
56+
}
57+
4658
/**
4759
* Initializes the Entitlement system:
4860
* <ol>
@@ -62,10 +74,16 @@ public static EntitlementChecker checker() {
6274
*
6375
* @param inst the JVM instrumentation class instance
6476
*/
65-
public static void initialize(Instrumentation inst) throws Exception {
66-
// the checker _MUST_ be set before _any_ instrumentation is done
67-
checker = initChecker(initializeArgs.policyManager());
68-
initInstrumentation(inst);
77+
public static void initialize(Instrumentation inst) {
78+
try {
79+
// the checker _MUST_ be set before _any_ instrumentation is done
80+
checker = initChecker(initializeArgs.policyManager());
81+
initInstrumentation(inst);
82+
} catch (Exception e) {
83+
// exceptions thrown within the agent will be swallowed, so capture it here
84+
// instead so that it can be retrieved by bootstrap
85+
error.set(new RuntimeException("Failed to initialize entitlements", e));
86+
}
6987
}
7088

7189
/**

0 commit comments

Comments
 (0)