Skip to content

Commit 1a157a5

Browse files
authored
Merge branch 'main' into source_provider_ref
2 parents e722106 + 79d3aa8 commit 1a157a5

File tree

54 files changed

+465
-493
lines changed

Some content is hidden

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

54 files changed

+465
-493
lines changed

docs/changelog/127563.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 127563
2+
summary: "ESQL: Avoid unintended attribute removal"
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 127468

docs/reference/query-languages/esql/esql-functions-operators.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,56 +12,67 @@ mapped_pages:
1212
## Functions overview [esql-functions]
1313

1414
::::{dropdown} Aggregate functions
15+
:open:
1516
:::{include} _snippets/lists/aggregation-functions.md
1617
:::
1718
::::
1819

1920
::::{dropdown} Grouping functions
21+
:open:
2022
:::{include} _snippets/lists/grouping-functions.md
2123
:::
2224
::::
2325

2426
::::{dropdown} Conditional functions and expressions
27+
:open:
2528
:::{include} _snippets/lists/conditional-functions-and-expressions.md
2629
:::
2730
::::
2831

2932
::::{dropdown} Date and time functions
33+
:open:
3034
:::{include} _snippets/lists/date-time-functions.md
3135
:::
3236
::::
3337

3438
::::{dropdown} IP functions
39+
:open:
3540
:::{include} _snippets/lists/ip-functions.md
3641
:::
3742
::::
3843

3944
::::{dropdown} Math functions
45+
:open:
4046
:::{include} _snippets/lists/math-functions.md
4147
:::
4248
::::
4349

4450
::::{dropdown} Search functions
51+
:open:
4552
:::{include} _snippets/lists/search-functions.md
4653
:::
4754
::::
4855

4956
::::{dropdown} Spatial functions
57+
:open:
5058
:::{include} _snippets/lists/spatial-functions.md
5159
:::
5260
::::
5361

5462
::::{dropdown} String functions
63+
:open:
5564
:::{include} _snippets/lists/string-functions.md
5665
:::
5766
::::
5867

5968
::::{dropdown} Type conversion functions
69+
:open:
6070
:::{include} _snippets/lists/type-conversion-functions.md
6171
:::
6272
::::
6373

6474
::::{dropdown} Multi value functions
75+
:open:
6576
:::{include} _snippets/lists/mv-functions.md
6677
:::
6778
::::
@@ -70,6 +81,7 @@ mapped_pages:
7081
## Operators overview [esql-operators-overview]
7182

7283
::::{dropdown} Operators
84+
:open:
7385
:::{include} _snippets/lists/operators.md
7486
:::
7587
::::

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ public record BootstrapArgs(
4343
Function<Class<?>, PolicyManager.PolicyScope> scopeResolver,
4444
PathLookup pathLookup,
4545
Map<String, Path> sourcePaths,
46-
Set<Class<?>> suppressFailureLogClasses
46+
Set<Package> suppressFailureLogPackages
4747
) {
4848
public BootstrapArgs {
4949
requireNonNull(pluginPolicies);
5050
requireNonNull(scopeResolver);
5151
requireNonNull(pathLookup);
5252
requireNonNull(sourcePaths);
53-
requireNonNull(suppressFailureLogClasses);
53+
requireNonNull(suppressFailureLogPackages);
5454
}
5555
}
5656

@@ -78,7 +78,7 @@ public static BootstrapArgs bootstrapArgs() {
7878
* @param tempDir the temp directory for Elasticsearch
7979
* @param logsDir the log directory for Elasticsearch
8080
* @param pidFile path to a pid file for Elasticsearch, or {@code null} if one was not specified
81-
* @param suppressFailureLogClasses classes for which we do not need or want to log Entitlements failures
81+
* @param suppressFailureLogPackages packages for which we do not need or want to log Entitlements failures
8282
*/
8383
public static void bootstrap(
8484
Policy serverPolicyPatch,
@@ -95,7 +95,7 @@ public static void bootstrap(
9595
Path logsDir,
9696
Path tempDir,
9797
Path pidFile,
98-
Set<Class<?>> suppressFailureLogClasses
98+
Set<Package> suppressFailureLogPackages
9999
) {
100100
logger.debug("Loading entitlement agent");
101101
if (EntitlementBootstrap.bootstrapArgs != null) {
@@ -119,7 +119,7 @@ public static void bootstrap(
119119
settingResolver
120120
),
121121
sourcePaths,
122-
suppressFailureLogClasses
122+
suppressFailureLogPackages
123123
);
124124
exportInitializationToAgent();
125125
loadAgent(findAgentJar());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private static PolicyManager createPolicyManager() {
9090
EntitlementBootstrap.bootstrapArgs().sourcePaths(),
9191
ENTITLEMENTS_MODULE,
9292
pathLookup,
93-
bootstrapArgs.suppressFailureLogClasses()
93+
bootstrapArgs.suppressFailureLogPackages()
9494
);
9595
}
9696

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ ModuleEntitlements policyEntitlements(String componentName, Path componentPath,
256256
private final Map<String, Map<String, List<Entitlement>>> pluginsEntitlements;
257257
private final Function<Class<?>, PolicyScope> scopeResolver;
258258
private final PathLookup pathLookup;
259-
private final Set<Class<?>> mutedClasses;
259+
private final Set<Package> suppressFailureLogPackages;
260260

261261
public static final String ALL_UNNAMED = "ALL-UNNAMED";
262262

@@ -311,7 +311,7 @@ public PolicyManager(
311311
Map<String, Path> sourcePaths,
312312
Module entitlementsModule,
313313
PathLookup pathLookup,
314-
Set<Class<?>> suppressFailureLogClasses
314+
Set<Package> suppressFailureLogPackages
315315
) {
316316
this.serverEntitlements = buildScopeEntitlementsMap(requireNonNull(serverPolicy));
317317
this.apmAgentEntitlements = apmAgentEntitlements;
@@ -322,7 +322,7 @@ public PolicyManager(
322322
this.sourcePaths = sourcePaths;
323323
this.entitlementsModule = entitlementsModule;
324324
this.pathLookup = requireNonNull(pathLookup);
325-
this.mutedClasses = suppressFailureLogClasses;
325+
this.suppressFailureLogPackages = suppressFailureLogPackages;
326326

327327
List<ExclusiveFileEntitlement> exclusiveFileEntitlements = new ArrayList<>();
328328
for (var e : serverEntitlements.entrySet()) {
@@ -688,8 +688,8 @@ public void checkWriteProperty(Class<?> callerClass, String property) {
688688

689689
private void notEntitled(String message, Class<?> callerClass, ModuleEntitlements entitlements) {
690690
var exception = new NotEntitledException(message);
691-
// Don't emit a log for muted classes, e.g. classes containing self tests
692-
if (mutedClasses.contains(callerClass) == false) {
691+
// Don't emit a log for suppressed packages, e.g. packages containing self tests
692+
if (suppressFailureLogPackages.contains(callerClass.getPackage()) == false) {
693693
entitlements.logger().warn("Not entitled: {}", message, exception);
694694
}
695695
throw exception;

muted-tests.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,6 @@ tests:
438438
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
439439
method: test {lookup-join.MvJoinKeyOnTheLookupIndex ASYNC}
440440
issue: https://github.com/elastic/elasticsearch/issues/128030
441-
- class: org.elasticsearch.compute.aggregation.PercentileIntGroupingAggregatorFunctionTests
442-
method: testManyInitialManyPartialFinalRunner
443-
issue: https://github.com/elastic/elasticsearch/issues/128092
444441
- class: org.elasticsearch.packaging.test.DockerTests
445442
method: test042KeystorePermissionsAreCorrect
446443
issue: https://github.com/elastic/elasticsearch/issues/128018
@@ -453,6 +450,18 @@ tests:
453450
- class: org.elasticsearch.packaging.test.DockerTests
454451
method: test041AmazonCaCertsAreInTheKeystore
455452
issue: https://github.com/elastic/elasticsearch/issues/128006
453+
- class: org.elasticsearch.packaging.test.DockerTests
454+
method: test130JavaHasCorrectOwnership
455+
issue: https://github.com/elastic/elasticsearch/issues/128174
456+
- class: org.elasticsearch.packaging.test.DockerTests
457+
method: test600Interrupt
458+
issue: https://github.com/elastic/elasticsearch/issues/128144
459+
- class: org.elasticsearch.packaging.test.EnrollmentProcessTests
460+
method: test20DockerAutoFormCluster
461+
issue: https://github.com/elastic/elasticsearch/issues/128113
462+
- class: org.elasticsearch.packaging.test.DockerTests
463+
method: test121CanUseStackLoggingConfig
464+
issue: https://github.com/elastic/elasticsearch/issues/128165
456465

457466
# Examples:
458467
#

plugins/discovery-azure-classic/src/main/java/org/elasticsearch/cloud/azure/classic/management/AzureComputeServiceImpl.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
import org.elasticsearch.logging.Logger;
3030

3131
import java.io.IOException;
32-
import java.security.AccessController;
33-
import java.security.PrivilegedActionException;
34-
import java.security.PrivilegedExceptionAction;
3532
import java.util.ServiceLoader;
3633

3734
public class AzureComputeServiceImpl extends AbstractLifecycleComponent implements AzureComputeService {
@@ -94,11 +91,8 @@ private static String getRequiredSetting(Settings settings, Setting<String> sett
9491
public HostedServiceGetDetailedResponse getServiceDetails() {
9592
SpecialPermission.check();
9693
try {
97-
return AccessController.doPrivileged(
98-
(PrivilegedExceptionAction<HostedServiceGetDetailedResponse>) () -> client.getHostedServicesOperations()
99-
.getDetailed(serviceName)
100-
);
101-
} catch (PrivilegedActionException e) {
94+
return client.getHostedServicesOperations().getDetailed(serviceName);
95+
} catch (Exception e) {
10296
throw new AzureServiceRemoteException("can not get list of azure nodes", e.getCause());
10397
}
10498
}

plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2SeedHostsProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected List<TransportAddress> fetchDynamicNodes() {
107107
// NOTE: we don't filter by security group during the describe instances request for two reasons:
108108
// 1. differences in VPCs require different parameters during query (ID vs Name)
109109
// 2. We want to use two different strategies: (all security groups vs. any security groups)
110-
descInstances = SocketAccess.doPrivileged(() -> clientReference.client().describeInstances(buildDescribeInstancesRequest()));
110+
descInstances = clientReference.client().describeInstances(buildDescribeInstancesRequest());
111111
} catch (final Exception e) {
112112
logger.info("Exception while retrieving instance list from AWS API: {}", e.getMessage());
113113
logger.debug("Full exception:", e);

plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2ServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private Ec2Client buildClient(Ec2ClientSettings clientSettings) {
6666
final var endpoint = Endpoint.builder().url(URI.create(clientSettings.endpoint)).build();
6767
ec2ClientBuilder.endpointProvider(endpointParams -> CompletableFuture.completedFuture(endpoint));
6868
}
69-
return SocketAccess.doPrivileged(ec2ClientBuilder::build);
69+
return ec2ClientBuilder.build();
7070
}
7171

7272
private static void applyProxyConfiguration(Ec2ClientSettings clientSettings, ApacheHttpClient.Builder httpClientBuilder) {

plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2Utils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class AwsEc2Utils {
2222
static String getInstanceMetadata(String metadataPath) {
2323
final var httpClientBuilder = ApacheHttpClient.builder();
2424
httpClientBuilder.connectionTimeout(IMDS_CONNECTION_TIMEOUT);
25-
try (var ec2Client = SocketAccess.doPrivileged(Ec2MetadataClient.builder().httpClient(httpClientBuilder)::build)) {
26-
final var metadataValue = SocketAccess.doPrivileged(() -> ec2Client.get(metadataPath)).asString();
25+
try (var ec2Client = Ec2MetadataClient.builder().httpClient(httpClientBuilder).build()) {
26+
final var metadataValue = ec2Client.get(metadataPath).asString();
2727
if (Strings.hasText(metadataValue) == false) {
2828
throw new IllegalStateException("no ec2 metadata returned from " + metadataPath);
2929
}

0 commit comments

Comments
 (0)