Skip to content

Commit

Permalink
Merge branch 'main' into test/die-with-dignity-pid6
Browse files Browse the repository at this point in the history
  • Loading branch information
rjernst committed Sep 15, 2023
2 parents c233e66 + 460c2ee commit 418b431
Show file tree
Hide file tree
Showing 47 changed files with 294 additions and 88 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipelines/periodic-platform-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ steps:
provider: gcp
image: family/elasticsearch-{{matrix.image}}
diskSizeGb: 350
machineType: custom-32-98304
machineType: n1-standard-32
env: {}
- group: platform-support-windows
steps:
Expand All @@ -50,7 +50,7 @@ steps:
agents:
provider: gcp
image: family/elasticsearch-{{matrix.image}}
machineType: custom-32-98304
machineType: n1-standard-32
diskType: pd-ssd
diskSizeGb: 350
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
- ^x-pack/docs/.*
white-list-labels:
- 'build-benchmark'
black-list-labels:
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
- ^x-pack/docs/.*
white-list-labels:
- 'build-benchmark'
black-list-labels:
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- 'test-windows'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
axes:
- axis:
type: slave
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
black-list-labels:
- '>test-mute'
- 'test-full-bwc'
- 'buildkite-opt-in'
axes:
- axis:
type: slave
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
- ^x-pack/docs/.*
white-list-labels:
- 'cloud-deploy'
black-list-labels:
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- ^x-pack/docs/.*
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- ^x-pack/docs/.*
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
- build-tools/.*
- build-tools-internal/.*
- plugins/examples/.*
black-list-labels:
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
1 change: 1 addition & 0 deletions .ci/jobs.t/elastic+elasticsearch+pull-request+full-bwc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- 'test-full-bwc'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
axes:
- axis:
type: slave
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
black-list-labels:
- '>test-mute'
- ':Delivery/Packaging'
- 'buildkite-opt-in'
axes:
- axis:
type: label-expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- ':Delivery/Packaging'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
axes:
- axis:
type: label-expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- ':Delivery/Packaging'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
axes:
- axis:
type: label-expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
black-list-labels:
- '>test-mute'
- ':Delivery/Packaging'
- 'buildkite-opt-in'
axes:
- axis:
type: label-expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
black-list-labels:
- '>test-mute'
- ':Delivery/Packaging'
- 'buildkite-opt-in'
axes:
- axis:
type: label-expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- ':Delivery/Packaging'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
axes:
- axis:
type: label-expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- ':Delivery/Packaging'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
axes:
- axis:
type: label-expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- 'Team:Security'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
# Use FIPS-specific Java versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- 'test-windows'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- 'Team:Security'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
# Use FIPS-specific Java versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- 'test-windows'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- 'Team:Security'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
# Use FIPS-specific Java versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- 'test-windows'
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
1 change: 1 addition & 0 deletions .ci/jobs.t/elastic+elasticsearch+pull-request+part-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- ^x-pack/docs/.*
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
black-list-target-branches:
- 6.8
- 7.17
Expand Down
2 changes: 2 additions & 0 deletions .ci/jobs.t/elastic+elasticsearch+pull-request+precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
cancel-builds-on-update: true
white-list-labels:
- '>test-mute'
black-list-labels:
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
- ^x-pack/docs/.*
white-list-labels:
- 'test-release'
black-list-labels:
- 'buildkite-opt-in'
black-list-target-branches:
- 7.15
- 6.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- ^x-pack/docs/.*
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
1 change: 1 addition & 0 deletions .ci/templates.t/pull-request-gradle-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- ^x-pack/docs/.*
black-list-labels:
- '>test-mute'
- 'buildkite-opt-in'
builders:
- inject:
properties-file: '.ci/java-versions.properties'
Expand Down
10 changes: 4 additions & 6 deletions server/src/main/java/org/elasticsearch/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
import org.elasticsearch.core.Booleans;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.internal.BuildExtension;
import org.elasticsearch.plugins.ExtensionLoader;

import java.io.IOException;
import java.net.URL;
import java.security.CodeSource;
import java.util.ServiceLoader;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;

Expand All @@ -41,12 +43,8 @@ private static class CurrentHolder {

// finds the pluggable current build, or uses the local build as a fallback
private static Build findCurrent() {
var buildExtension = BuildExtension.load();
if (buildExtension == null) {
return findLocalBuild();
}
var build = buildExtension.getCurrentBuild();
return build;
var buildExtension = ExtensionLoader.loadSingleton(ServiceLoader.load(BuildExtension.class), () -> Build::findLocalBuild);
return buildExtension.getCurrentBuild();
}
}

Expand Down
4 changes: 3 additions & 1 deletion server/src/main/java/org/elasticsearch/TransportVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.internal.VersionExtension;
import org.elasticsearch.plugins.ExtensionLoader;

import java.io.IOException;
import java.util.ServiceLoader;

/**
* Represents the version of the wire protocol used to communicate between a pair of ES nodes.
Expand Down Expand Up @@ -109,7 +111,7 @@ private static class CurrentHolder {

// finds the pluggable current version, or uses the given fallback
private static TransportVersion findCurrent() {
var versionExtension = VersionExtension.load();
var versionExtension = ExtensionLoader.loadSingleton(ServiceLoader.load(VersionExtension.class), () -> null);
if (versionExtension == null) {
return TransportVersions.LATEST_DEFINED;
}
Expand Down
24 changes: 6 additions & 18 deletions server/src/main/java/org/elasticsearch/action/ActionModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ public class ActionModule extends AbstractModule {
private final ThreadPool threadPool;
private final ReservedClusterStateService reservedClusterStateService;
private final boolean serverlessEnabled;
private final RestExtension restExtension;

public ActionModule(
Settings settings,
Expand All @@ -525,7 +526,8 @@ public ActionModule(
SystemIndices systemIndices,
Tracer tracer,
ClusterService clusterService,
List<ReservedClusterStateHandler<?>> reservedStateHandlers
List<ReservedClusterStateHandler<?>> reservedStateHandlers,
RestExtension restExtension
) {
this.settings = settings;
this.indexNameExpressionResolver = indexNameExpressionResolver;
Expand Down Expand Up @@ -572,6 +574,7 @@ public ActionModule(
restController = new RestController(restInterceptor, nodeClient, circuitBreakerService, usageService, tracer);
}
reservedClusterStateService = new ReservedClusterStateService(clusterService, reservedStateHandlers);
this.restExtension = restExtension;
}

private static <T> T getRestServerComponent(
Expand Down Expand Up @@ -851,15 +854,10 @@ private static ActionFilters setupActionFilters(List<ActionPlugin> actionPlugins

public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
List<AbstractCatAction> catActions = new ArrayList<>();
var restExtension = RestExtension.load(() -> new RestExtension() {
@Override
public Predicate<AbstractCatAction> getCatActionsFilter() {
return action -> true;
}
});
Predicate<AbstractCatAction> catActionsFilter = restExtension.getCatActionsFilter();
Predicate<RestHandler> restFilter = restExtension.getActionsFilter();
Consumer<RestHandler> registerHandler = handler -> {
if (shouldKeepRestHandler(handler)) {
if (restFilter.test(handler)) {
if (handler instanceof AbstractCatAction catAction && catActionsFilter.test(catAction)) {
catActions.add(catAction);
}
Expand Down Expand Up @@ -1066,16 +1064,6 @@ public Predicate<AbstractCatAction> getCatActionsFilter() {
registerHandler.accept(new RestDeleteSynonymRuleAction());
}

/**
* This method is used to determine whether a RestHandler ought to be kept in memory or not. Returns true if serverless mode is
* disabled, or if there is any ServlerlessScope annotation on the RestHandler.
* @param handler
* @return
*/
private boolean shouldKeepRestHandler(final RestHandler handler) {
return serverlessEnabled == false || handler.getServerlessScope() != null;
}

@Override
protected void configure() {
bind(ActionFilters.class).toInstance(actionFilters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.core.Assertions;
import org.elasticsearch.internal.VersionExtension;
import org.elasticsearch.plugins.ExtensionLoader;
import org.elasticsearch.xcontent.ToXContentFragment;
import org.elasticsearch.xcontent.XContentBuilder;

Expand All @@ -25,6 +26,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.NavigableMap;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.TreeMap;

Expand Down Expand Up @@ -154,7 +156,7 @@ private static class CurrentHolder {

// finds the pluggable current version, or uses the given fallback
private static IndexVersion findCurrent(IndexVersion fallback) {
var versionExtension = VersionExtension.load();
var versionExtension = ExtensionLoader.loadSingleton(ServiceLoader.load(VersionExtension.class), () -> null);
if (versionExtension == null) {
return fallback;
}
Expand Down
Loading

0 comments on commit 418b431

Please sign in to comment.