Skip to content

Commit 105e35e

Browse files
authored
Merge branch 'main' into inference/streaming-writeable
2 parents 66ed99d + 482a49f commit 105e35e

File tree

59 files changed

+1532
-321
lines changed

Some content is hidden

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

59 files changed

+1532
-321
lines changed

docs/changelog/122199.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122199
2+
summary: Fix issues that prevents using search only snapshots for indices that use index sorting. This is includes Logsdb and time series indices.
3+
area: Logs
4+
type: bug
5+
issues: []

docs/changelog/122224.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 122224
2+
summary: Enable the use of nested field type with index.mode=time_series
3+
area: Mapping
4+
type: enhancement
5+
issues:
6+
- 120874

docs/changelog/122357.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 122357
2+
summary: Handle search timeout in `SuggestPhase`
3+
area: Search
4+
type: bug
5+
issues:
6+
- 122186

docs/changelog/122427.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122427
2+
summary: Improve size limiting string message
3+
area: Infra/Core
4+
type: enhancement
5+
issues: []

docs/changelog/122496.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122496
2+
summary: Deduplicate `IngestStats` and `IngestStats.Stats` identity records when deserializing
3+
area: Ingest Node
4+
type: bug
5+
issues: []

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,13 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
152152
if (isAnnotationPresent == false) {
153153
boolean isStatic = (access & ACC_STATIC) != 0;
154154
boolean isCtor = "<init>".equals(name);
155-
boolean hasReceiver = (isStatic || isCtor) == false;
156155
var key = new MethodKey(className, name, Stream.of(Type.getArgumentTypes(descriptor)).map(Type::getInternalName).toList());
157156
var instrumentationMethod = checkMethods.get(key);
158157
if (instrumentationMethod != null) {
159-
// LOGGER.debug("Will instrument method {}", key);
158+
// System.out.println("Will instrument method " + key);
160159
return new EntitlementMethodVisitor(Opcodes.ASM9, mv, isStatic, isCtor, descriptor, instrumentationMethod);
161160
} else {
162-
// LOGGER.trace("Will not instrument method {}", key);
161+
// System.out.println("Will not instrument method " + key);
163162
}
164163
}
165164
return mv;

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
import java.util.Set;
7070
import java.util.TimeZone;
7171
import java.util.concurrent.ExecutorService;
72+
import java.util.concurrent.ForkJoinPool;
7273
import java.util.function.Consumer;
7374

7475
import javax.net.ssl.HostnameVerifier;
@@ -652,4 +653,26 @@ void checkNewByteChannel(
652653
void checkName(Class<?> callerClass, FileStore that);
653654

654655
void checkType(Class<?> callerClass, FileStore that);
656+
657+
////////////////////
658+
//
659+
// Thread management
660+
//
661+
662+
void check$java_lang_Thread$start(Class<?> callerClass, Thread thread);
663+
664+
void check$java_lang_Thread$setDaemon(Class<?> callerClass, Thread thread, boolean on);
665+
666+
void check$java_lang_ThreadGroup$setDaemon(Class<?> callerClass, ThreadGroup threadGroup, boolean daemon);
667+
668+
void check$java_util_concurrent_ForkJoinPool$setParallelism(Class<?> callerClass, ForkJoinPool forkJoinPool, int size);
669+
670+
void check$java_lang_Thread$setName(Class<?> callerClass, Thread thread, String name);
671+
672+
void check$java_lang_Thread$setPriority(Class<?> callerClass, Thread thread, int newPriority);
673+
674+
void check$java_lang_Thread$setUncaughtExceptionHandler(Class<?> callerClass, Thread thread, Thread.UncaughtExceptionHandler ueh);
675+
676+
void check$java_lang_ThreadGroup$setMaxPriority(Class<?> callerClass, ThreadGroup threadGroup, int pri);
677+
655678
}

libs/entitlement/qa/entitled-plugin/src/main/java/org/elasticsearch/entitlement/qa/entitled/EntitledActions.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ private static Path readWriteDir() {
3434
return testRootDir.resolve("read_write_dir");
3535
}
3636

37-
static void System_clearProperty(String key) {
38-
System.clearProperty(key);
39-
}
40-
4137
public static UserPrincipal getFileOwner(Path path) throws IOException {
4238
return Files.getOwner(path);
4339
}

libs/entitlement/qa/entitled-plugin/src/main/java/org/elasticsearch/entitlement/qa/entitled/EntitledPlugin.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.elasticsearch.plugins.ExtensiblePlugin;
1616
import org.elasticsearch.plugins.Plugin;
1717

18-
import static org.elasticsearch.entitlement.qa.entitled.EntitledActions.System_clearProperty;
18+
import java.util.concurrent.atomic.AtomicBoolean;
1919

2020
public class EntitledPlugin extends Plugin implements ExtensiblePlugin {
2121

@@ -28,11 +28,19 @@ public static void selfTest() {
2828
selfTestNotEntitled();
2929
}
3030

31-
private static final String SELF_TEST_PROPERTY = "org.elasticsearch.entitlement.qa.selfTest";
32-
3331
private static void selfTestEntitled() {
3432
logger.debug("selfTestEntitled");
35-
System_clearProperty(SELF_TEST_PROPERTY);
33+
AtomicBoolean threadRan = new AtomicBoolean(false);
34+
try {
35+
Thread testThread = new Thread(() -> threadRan.set(true), "testThread");
36+
testThread.start();
37+
testThread.join();
38+
} catch (InterruptedException e) {
39+
throw new AssertionError(e);
40+
}
41+
if (threadRan.get() == false) {
42+
throw new AssertionError("Self-test thread did not run");
43+
}
3644
}
3745

3846
private static void selfTestNotEntitled() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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.entitlement.qa.test;
11+
12+
import org.elasticsearch.core.SuppressForbidden;
13+
14+
import java.util.concurrent.ForkJoinPool;
15+
import java.util.concurrent.atomic.AtomicBoolean;
16+
17+
import static java.lang.Thread.currentThread;
18+
import static org.elasticsearch.entitlement.qa.test.EntitlementTest.ExpectedAccess.PLUGINS;
19+
20+
@SuppressForbidden(reason = "testing entitlements")
21+
@SuppressWarnings("unused") // used via reflection
22+
class ManageThreadsActions {
23+
private ManageThreadsActions() {}
24+
25+
@EntitlementTest(expectedAccess = PLUGINS)
26+
static void java_lang_Thread$start() throws InterruptedException {
27+
AtomicBoolean threadRan = new AtomicBoolean(false);
28+
Thread thread = new Thread(() -> threadRan.set(true), "test");
29+
thread.start();
30+
thread.join();
31+
assert threadRan.get();
32+
}
33+
34+
@EntitlementTest(expectedAccess = PLUGINS)
35+
static void java_lang_Thread$setDaemon() {
36+
new Thread().setDaemon(true);
37+
}
38+
39+
@EntitlementTest(expectedAccess = PLUGINS)
40+
static void java_lang_ThreadGroup$setDaemon() {
41+
currentThread().getThreadGroup().setDaemon(currentThread().getThreadGroup().isDaemon());
42+
}
43+
44+
@EntitlementTest(expectedAccess = PLUGINS)
45+
static void java_util_concurrent_ForkJoinPool$setParallelism() {
46+
ForkJoinPool.commonPool().setParallelism(ForkJoinPool.commonPool().getParallelism());
47+
}
48+
49+
@EntitlementTest(expectedAccess = PLUGINS)
50+
static void java_lang_Thread$setName() {
51+
currentThread().setName(currentThread().getName());
52+
}
53+
54+
@EntitlementTest(expectedAccess = PLUGINS)
55+
static void java_lang_Thread$setPriority() {
56+
currentThread().setPriority(currentThread().getPriority());
57+
}
58+
59+
@EntitlementTest(expectedAccess = PLUGINS)
60+
static void java_lang_Thread$setUncaughtExceptionHandler() {
61+
currentThread().setUncaughtExceptionHandler(currentThread().getUncaughtExceptionHandler());
62+
}
63+
64+
@EntitlementTest(expectedAccess = PLUGINS)
65+
static void java_lang_ThreadGroup$setMaxPriority() {
66+
currentThread().getThreadGroup().setMaxPriority(currentThread().getThreadGroup().getMaxPriority());
67+
}
68+
69+
}

0 commit comments

Comments
 (0)