Skip to content

Commit 3473791

Browse files
committed
Merge remote-tracking branch 'elastic/main' into fix-driver-exceptions
2 parents 20904e8 + d11dad4 commit 3473791

File tree

61 files changed

+1026
-440
lines changed

Some content is hidden

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

61 files changed

+1026
-440
lines changed

.buildkite/scripts/dra-update-staging.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ for BRANCH in "${BRANCHES[@]}"; do
3636
fi
3737

3838
if [[ "$SHOULD_TRIGGER" == "true" ]]; then
39+
if [[ "$BRANCH" == "9.0" ]]; then
40+
export VERSION_QUALIFIER="beta1"
41+
fi
3942
echo "Triggering DRA staging workflow for $BRANCH"
4043
cat << EOF | buildkite-agent pipeline upload
4144
steps:
@@ -46,6 +49,7 @@ steps:
4649
branch: "$BRANCH"
4750
env:
4851
DRA_WORKFLOW: staging
52+
VERSION_QUALIFIER: ${VERSION_QUALIFIER:-}
4953
EOF
5054
fi
5155
done

docs/changelog/121805.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121805
2+
summary: Support subset of metrics in aggregate metric double
3+
area: "ES|QL"
4+
type: enhancement
5+
issues: []

docs/changelog/121843.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 121843
2+
summary: Fix async stop sometimes not properly collecting result
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 121249

docs/changelog/122047.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122047
2+
summary: Fork post-snapshot-delete cleanup off master thread
3+
area: Snapshot/Restore
4+
type: bug
5+
issues: []

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.nio.channels.SocketChannel;
5151
import java.nio.channels.spi.SelectorProvider;
5252
import java.nio.charset.Charset;
53+
import java.nio.file.LinkOption;
5354
import java.nio.file.OpenOption;
5455
import java.nio.file.Path;
5556
import java.nio.file.attribute.UserPrincipal;
@@ -514,6 +515,8 @@ public interface EntitlementChecker {
514515
void check$java_util_Scanner$(Class<?> callerClass, File source, Charset charset);
515516

516517
// nio
518+
void check$java_nio_file_Files$$getOwner(Class<?> callerClass, Path path, LinkOption... options);
519+
517520
void check$java_nio_file_Files$$probeContentType(Class<?> callerClass, Path path);
518521

519522
void check$java_nio_file_Files$$setOwner(Class<?> callerClass, Path path, UserPrincipal principal);

libs/entitlement/qa/entitled-plugin/src/main/plugin-metadata/entitlement-policy.yaml

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

libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileCheckActions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ static void createFileOutputStreamFileWithAppend() throws IOException {
8080
new FileOutputStream(readWriteFile().toFile(), false).close();
8181
}
8282

83+
@EntitlementTest(expectedAccess = PLUGINS)
84+
static void filesGetOwner() throws IOException {
85+
Files.getOwner(readFile());
86+
}
87+
8388
@EntitlementTest(expectedAccess = PLUGINS)
8489
static void filesProbeContentType() throws IOException {
8590
Files.probeContentType(readFile());

libs/entitlement/qa/src/javaRestTest/java/org/elasticsearch/entitlement/qa/AbstractEntitlementsIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import org.elasticsearch.client.Request;
1313
import org.elasticsearch.client.Response;
14+
import org.elasticsearch.entitlement.qa.EntitlementsTestRule.PolicyBuilder;
1415
import org.elasticsearch.test.rest.ESRestTestCase;
1516

1617
import java.io.IOException;
@@ -22,7 +23,7 @@
2223

2324
public abstract class AbstractEntitlementsIT extends ESRestTestCase {
2425

25-
static final EntitlementsTestRule.PolicyBuilder ALLOWED_TEST_ENTITLEMENTS = (builder, tempDir) -> {
26+
static final PolicyBuilder ALLOWED_TEST_ENTITLEMENTS = (builder, tempDir) -> {
2627
builder.value("create_class_loader");
2728
builder.value("set_https_connection_properties");
2829
builder.value("inbound_network");

libs/entitlement/qa/src/javaRestTest/java/org/elasticsearch/entitlement/qa/EntitlementsTestRule.java

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,27 @@
2626
import java.io.UncheckedIOException;
2727
import java.nio.file.Files;
2828
import java.nio.file.Path;
29+
import java.util.List;
30+
import java.util.Map;
2931

3032
class EntitlementsTestRule implements TestRule {
3133

34+
// entitlements that test methods may use, see EntitledActions
35+
private static final PolicyBuilder ENTITLED_POLICY = (builder, tempDir) -> {
36+
builder.value(Map.of("write_system_properties", Map.of("properties", List.of("org.elasticsearch.entitlement.qa.selfTest"))));
37+
builder.value(
38+
Map.of(
39+
"files",
40+
List.of(
41+
Map.of("path", tempDir.resolve("read_dir"), "mode", "read"),
42+
Map.of("path", tempDir.resolve("read_write_dir"), "mode", "read_write"),
43+
Map.of("path", tempDir.resolve("read_file"), "mode", "read"),
44+
Map.of("path", tempDir.resolve("read_write_file"), "mode", "read_write")
45+
)
46+
)
47+
);
48+
};
49+
3250
interface PolicyBuilder {
3351
void build(XContentBuilder builder, Path tempDir) throws IOException;
3452
}
@@ -51,7 +69,7 @@ protected void before() throws Throwable {
5169
}
5270
};
5371
cluster = ElasticsearchCluster.local()
54-
.module("entitled")
72+
.module("entitled", spec -> buildEntitlements(spec, "org.elasticsearch.entitlement.qa.entitled", ENTITLED_POLICY))
5573
.module("entitlement-test-plugin", spec -> setupEntitlements(spec, modular, policyBuilder))
5674
.systemProperty("es.entitlements.enabled", "true")
5775
.systemProperty("es.entitlements.testdir", () -> testDir.getRoot().getAbsolutePath())
@@ -65,29 +83,30 @@ public Statement apply(Statement statement, Description description) {
6583
return ruleChain.apply(statement, description);
6684
}
6785

68-
private void setupEntitlements(PluginInstallSpec spec, boolean modular, PolicyBuilder policyBuilder) {
69-
String moduleName = modular ? "org.elasticsearch.entitlement.qa.test" : "ALL-UNNAMED";
70-
if (policyBuilder != null) {
71-
spec.withEntitlementsOverride(old -> {
72-
try {
73-
try (var builder = YamlXContent.contentBuilder()) {
74-
builder.startObject();
75-
builder.field(moduleName);
76-
builder.startArray();
86+
private void buildEntitlements(PluginInstallSpec spec, String moduleName, PolicyBuilder policyBuilder) {
87+
spec.withEntitlementsOverride(old -> {
88+
try (var builder = YamlXContent.contentBuilder()) {
89+
builder.startObject();
90+
builder.field(moduleName);
91+
builder.startArray();
7792

78-
policyBuilder.build(builder, testDir.getRoot().toPath());
79-
builder.endArray();
80-
builder.endObject();
93+
policyBuilder.build(builder, testDir.getRoot().toPath());
94+
builder.endArray();
95+
builder.endObject();
8196

82-
String policy = Strings.toString(builder);
83-
System.out.println("Using entitlement policy:\n" + policy);
84-
return Resource.fromString(policy);
85-
}
97+
String policy = Strings.toString(builder);
98+
System.out.println("Using entitlement policy for module " + moduleName + ":\n" + policy);
99+
return Resource.fromString(policy);
100+
} catch (IOException e) {
101+
throw new UncheckedIOException(e);
102+
}
103+
});
104+
}
86105

87-
} catch (IOException e) {
88-
throw new UncheckedIOException(e);
89-
}
90-
});
106+
private void setupEntitlements(PluginInstallSpec spec, boolean modular, PolicyBuilder policyBuilder) {
107+
String moduleName = modular ? "org.elasticsearch.entitlement.qa.test" : "ALL-UNNAMED";
108+
if (policyBuilder != null) {
109+
buildEntitlements(spec, moduleName, policyBuilder);
91110
}
92111

93112
if (modular == false) {

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import java.nio.channels.SocketChannel;
5656
import java.nio.channels.spi.SelectorProvider;
5757
import java.nio.charset.Charset;
58+
import java.nio.file.LinkOption;
5859
import java.nio.file.OpenOption;
5960
import java.nio.file.Path;
6061
import java.nio.file.attribute.UserPrincipal;
@@ -976,6 +977,11 @@ public void checkSelectorProviderInheritedChannel(Class<?> callerClass, Selector
976977

977978
// nio
978979

980+
@Override
981+
public void check$java_nio_file_Files$$getOwner(Class<?> callerClass, Path path, LinkOption... options) {
982+
policyManager.checkFileRead(callerClass, path);
983+
}
984+
979985
@Override
980986
public void check$java_nio_file_Files$$probeContentType(Class<?> callerClass, Path path) {
981987
policyManager.checkFileRead(callerClass, path);

0 commit comments

Comments
 (0)