diff --git a/.buildkite/pipelines/intake.yml b/.buildkite/pipelines/intake.yml index 92423539caf09..0f89ba9b8aeba 100644 --- a/.buildkite/pipelines/intake.yml +++ b/.buildkite/pipelines/intake.yml @@ -40,7 +40,7 @@ steps: timeout_in_minutes: 300 matrix: setup: - BWC_VERSION: ["7.17.14", "8.10.1", "8.11.0"] + BWC_VERSION: ["7.17.14", "8.10.2", "8.11.0"] agents: provider: gcp image: family/elasticsearch-ubuntu-2004 diff --git a/.buildkite/pipelines/periodic-packaging.yml b/.buildkite/pipelines/periodic-packaging.yml index 6730a2d60e7e9..1fd69ec8d8a2c 100644 --- a/.buildkite/pipelines/periodic-packaging.yml +++ b/.buildkite/pipelines/periodic-packaging.yml @@ -1616,6 +1616,22 @@ steps: env: BWC_VERSION: 8.10.1 + - label: "{{matrix.image}} / 8.10.2 / packaging-tests-upgrade" + command: ./.ci/scripts/packaging-test.sh --build-cache -Dorg.elasticsearch.build.cache.url=https://gradle-enterprise.elastic.co/cache/ -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.10.2 + timeout_in_minutes: 300 + matrix: + setup: + image: + - rocky-8 + - ubuntu-2004 + agents: + provider: gcp + image: family/elasticsearch-{{matrix.image}} + machineType: custom-16-32768 + buildDirectory: /dev/shm/bk + env: + BWC_VERSION: 8.10.2 + - label: "{{matrix.image}} / 8.11.0 / packaging-tests-upgrade" command: ./.ci/scripts/packaging-test.sh --build-cache -Dorg.elasticsearch.build.cache.url=https://gradle-enterprise.elastic.co/cache/ -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.11.0 timeout_in_minutes: 300 diff --git a/.buildkite/pipelines/periodic-platform-support.yml b/.buildkite/pipelines/periodic-platform-support.yml index 520089286ec36..8522ead742768 100644 --- a/.buildkite/pipelines/periodic-platform-support.yml +++ b/.buildkite/pipelines/periodic-platform-support.yml @@ -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: @@ -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: diff --git a/.buildkite/pipelines/periodic.yml b/.buildkite/pipelines/periodic.yml index bc0dce06312a0..fe28b0a0cea64 100644 --- a/.buildkite/pipelines/periodic.yml +++ b/.buildkite/pipelines/periodic.yml @@ -992,6 +992,16 @@ steps: buildDirectory: /dev/shm/bk env: BWC_VERSION: 8.10.1 + - label: 8.10.2 / bwc + command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.10.2#bwcTest + timeout_in_minutes: 300 + agents: + provider: gcp + image: family/elasticsearch-ubuntu-2004 + machineType: custom-32-98304 + buildDirectory: /dev/shm/bk + env: + BWC_VERSION: 8.10.2 - label: 8.11.0 / bwc command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.11.0#bwcTest timeout_in_minutes: 300 diff --git a/.ci/bwcVersions b/.ci/bwcVersions index 902c5356f9bae..ea42d7d4f0cc6 100644 --- a/.ci/bwcVersions +++ b/.ci/bwcVersions @@ -98,4 +98,5 @@ BWC_VERSION: - "8.9.2" - "8.10.0" - "8.10.1" + - "8.10.2" - "8.11.0" diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+build-benchmark-part1.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+build-benchmark-part1.yml index 064ac3022141f..a3f1345a07f13 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+build-benchmark-part1.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+build-benchmark-part1.yml @@ -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' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+build-benchmark-part2.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+build-benchmark-part2.yml index bf72ffa54cdae..f1b11ab1ec75a 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+build-benchmark-part2.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+build-benchmark-part2.yml @@ -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' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+bwc-snapshots-windows.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+bwc-snapshots-windows.yml index 629700daa70e2..c0ed9bf998159 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+bwc-snapshots-windows.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+bwc-snapshots-windows.yml @@ -29,6 +29,7 @@ - 'test-windows' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' axes: - axis: type: slave diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+bwc-snapshots.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+bwc-snapshots.yml index 86da8986f27e5..676f5f6f629b7 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+bwc-snapshots.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+bwc-snapshots.yml @@ -26,6 +26,7 @@ black-list-labels: - '>test-mute' - 'test-full-bwc' + - 'buildkite-opt-in' axes: - axis: type: slave diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+cloud-deploy.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+cloud-deploy.yml index eedbf7bba5789..24548954d8a10 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+cloud-deploy.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+cloud-deploy.yml @@ -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' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+docs-check.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+docs-check.yml index 77c499f455b22..c766b4379a1f6 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+docs-check.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+docs-check.yml @@ -23,6 +23,7 @@ - ^x-pack/docs/.* black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: properties-file: '.ci/java-versions.properties' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+eql-correctness.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+eql-correctness.yml index fcdbf2ea87084..0b9eea62ad9bf 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+eql-correctness.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+eql-correctness.yml @@ -25,6 +25,7 @@ - ^x-pack/docs/.* black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: properties-file: '.ci/java-versions.properties' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+example-plugins.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+example-plugins.yml index f79c98c00101f..320a9c6176d5f 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+example-plugins.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+example-plugins.yml @@ -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' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+full-bwc.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+full-bwc.yml index 5276d39f956d3..2a7920e4bae89 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+full-bwc.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+full-bwc.yml @@ -27,6 +27,7 @@ - 'test-full-bwc' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' axes: - axis: type: slave diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix-sample.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix-sample.yml index c283da8e32479..04e48036a8e9e 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix-sample.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix-sample.yml @@ -27,6 +27,7 @@ black-list-labels: - '>test-mute' - ':Delivery/Packaging' + - 'buildkite-opt-in' axes: - axis: type: label-expression diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix.yml index 95a4c4273ebb7..a7413699ff6c3 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix.yml @@ -28,6 +28,7 @@ - ':Delivery/Packaging' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' axes: - axis: type: label-expression diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-nojdk.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-nojdk.yml index ecd4a1a084755..ea4097b1a0b93 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-nojdk.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-nojdk.yml @@ -32,6 +32,7 @@ - ':Delivery/Packaging' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' axes: - axis: type: label-expression diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-sample-nojdk.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-sample-nojdk.yml index 091dcf9eb77a0..ec644445ef8de 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-sample-nojdk.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-sample-nojdk.yml @@ -31,6 +31,7 @@ black-list-labels: - '>test-mute' - ':Delivery/Packaging' + - 'buildkite-opt-in' axes: - axis: type: label-expression diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-sample.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-sample.yml index a438335529a3c..242e137cb1d83 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-sample.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows-sample.yml @@ -30,6 +30,7 @@ black-list-labels: - '>test-mute' - ':Delivery/Packaging' + - 'buildkite-opt-in' axes: - axis: type: label-expression diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows.yml index 1dc0127284c47..a2ffc7b4050ec 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-windows.yml @@ -32,6 +32,7 @@ - ':Delivery/Packaging' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' axes: - axis: type: label-expression diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-upgrade-tests.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-upgrade-tests.yml index 01770b7d94c6e..2b73d0144cab7 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-upgrade-tests.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-upgrade-tests.yml @@ -29,6 +29,7 @@ - ':Delivery/Packaging' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' axes: - axis: type: label-expression diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-fips.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-fips.yml index 793ade87a1fd9..a661230d3b93b 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-fips.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-fips.yml @@ -27,6 +27,7 @@ - 'Team:Security' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: # Use FIPS-specific Java versions diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-windows.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-windows.yml index 9a55d8dc6eeac..d7afdd0ac3277 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-windows.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-windows.yml @@ -28,6 +28,7 @@ - 'test-windows' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: properties-file: '.ci/java-versions.properties' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-fips.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-fips.yml index 0795172b916e2..913820709dabc 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-fips.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-fips.yml @@ -27,6 +27,7 @@ - 'Team:Security' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: # Use FIPS-specific Java versions diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-windows.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-windows.yml index de09d5044d466..ae590872be16e 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-windows.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-windows.yml @@ -28,6 +28,7 @@ - 'test-windows' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: properties-file: '.ci/java-versions.properties' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3-fips.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3-fips.yml index 3383e81ae61ed..6bf6544d40310 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3-fips.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3-fips.yml @@ -28,6 +28,7 @@ - 'Team:Security' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: # Use FIPS-specific Java versions diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3-windows.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3-windows.yml index 65ed5c58335a9..58bad17954b24 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3-windows.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3-windows.yml @@ -29,6 +29,7 @@ - 'test-windows' black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: properties-file: '.ci/java-versions.properties' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3.yml index 325b9ecb68fd9..0158b909903b4 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+part-3.yml @@ -23,6 +23,7 @@ - ^x-pack/docs/.* black-list-labels: - '>test-mute' + - 'buildkite-opt-in' black-list-target-branches: - 6.8 - 7.17 diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+precommit.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+precommit.yml index 60878f1519555..1267b6a21778e 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+precommit.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+precommit.yml @@ -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' diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+release-tests.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+release-tests.yml index 98ada6e2080e4..1ab6bd1ce0e5d 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+release-tests.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+release-tests.yml @@ -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 diff --git a/.ci/jobs.t/elastic+elasticsearch+pull-request+rest-compatibility.yml b/.ci/jobs.t/elastic+elasticsearch+pull-request+rest-compatibility.yml index 417ce525880d6..216f8ceae2078 100644 --- a/.ci/jobs.t/elastic+elasticsearch+pull-request+rest-compatibility.yml +++ b/.ci/jobs.t/elastic+elasticsearch+pull-request+rest-compatibility.yml @@ -28,6 +28,7 @@ - ^x-pack/docs/.* black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: properties-file: '.ci/java-versions.properties' diff --git a/.ci/snapshotBwcVersions b/.ci/snapshotBwcVersions index bb57c7b896311..2620f98f1cec1 100644 --- a/.ci/snapshotBwcVersions +++ b/.ci/snapshotBwcVersions @@ -1,4 +1,4 @@ BWC_VERSION: - "7.17.14" - - "8.10.1" + - "8.10.2" - "8.11.0" diff --git a/.ci/templates.t/pull-request-gradle-unix.yml b/.ci/templates.t/pull-request-gradle-unix.yml index b4b5c48739097..c09e64c56f32d 100644 --- a/.ci/templates.t/pull-request-gradle-unix.yml +++ b/.ci/templates.t/pull-request-gradle-unix.yml @@ -23,6 +23,7 @@ - ^x-pack/docs/.* black-list-labels: - '>test-mute' + - 'buildkite-opt-in' builders: - inject: properties-file: '.ci/java-versions.properties' diff --git a/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/TopNBenchmark.java b/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/TopNBenchmark.java index f4b5397e55d39..9ef4eef2a6924 100644 --- a/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/TopNBenchmark.java +++ b/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/TopNBenchmark.java @@ -9,6 +9,9 @@ package org.elasticsearch.benchmark.compute.operator; import org.apache.lucene.util.BytesRef; +import org.elasticsearch.common.breaker.CircuitBreaker; +import org.elasticsearch.common.settings.ClusterSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.compute.data.Block; import org.elasticsearch.compute.data.BooleanBlock; import org.elasticsearch.compute.data.BytesRefBlock; @@ -20,6 +23,8 @@ import org.elasticsearch.compute.operator.Operator; import org.elasticsearch.compute.operator.topn.TopNEncoder; import org.elasticsearch.compute.operator.topn.TopNOperator; +import org.elasticsearch.indices.breaker.CircuitBreakerService; +import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; @@ -96,7 +101,13 @@ private static Operator operator(String data, int topCount) { case LONGS_AND_BYTES_REFS -> List.of(TopNEncoder.DEFAULT_SORTABLE, TopNEncoder.UTF8); default -> throw new IllegalArgumentException("unsupported data type [" + data + "]"); }; + CircuitBreakerService breakerService = new HierarchyCircuitBreakerService( + Settings.EMPTY, + List.of(), + ClusterSettings.createBuiltInClusterSettings() + ); return new TopNOperator( + breakerService.getBreaker(CircuitBreaker.REQUEST), topCount, elementTypes, encoders, diff --git a/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/precommit/TestingConventionsPrecommitPluginFuncTest.groovy b/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/precommit/TestingConventionsPrecommitPluginFuncTest.groovy index 31ecffc07f63f..f6cbef21f5655 100644 --- a/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/precommit/TestingConventionsPrecommitPluginFuncTest.groovy +++ b/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/precommit/TestingConventionsPrecommitPluginFuncTest.groovy @@ -172,6 +172,7 @@ class TestingConventionsPrecommitPluginFuncTest extends AbstractGradleInternalPl def "applies conventions on yaml-rest-test tests"() { given: + buildApiRestrictionsDisabled = true clazz(dir('src/yamlRestTest/java'), "org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase") buildFile << """ apply plugin:'elasticsearch.legacy-yaml-rest-test' @@ -211,6 +212,7 @@ class TestingConventionsPrecommitPluginFuncTest extends AbstractGradleInternalPl @Unroll def "applies conventions on #sourceSetName tests"() { given: + buildApiRestrictionsDisabled = pluginName.contains('legacy') clazz(dir("src/${sourceSetName}/java"), "org.elasticsearch.test.ESIntegTestCase") clazz(dir("src/${sourceSetName}/java"), "org.elasticsearch.test.rest.ESRestTestCase") buildFile << """ diff --git a/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestCompatTestPluginFuncTest.groovy b/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestCompatTestPluginFuncTest.groovy index cf0cab3b952f3..74f5b32dff3cc 100644 --- a/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestCompatTestPluginFuncTest.groovy +++ b/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestCompatTestPluginFuncTest.groovy @@ -33,7 +33,9 @@ class LegacyYamlRestCompatTestPluginFuncTest extends AbstractRestResourcesFuncTe // 1. TestClustersPlugin not cc compatible due to listener registration // 2. RestIntegTestTask not cc compatible due to configurationCacheCompatible = false + buildApiRestrictionsDisabled = true } + def "yamlRestTestVxCompatTest does nothing when there are no tests"() { given: subProject(":distribution:bwc:maintenance") << """ diff --git a/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestTestPluginFuncTest.groovy b/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestTestPluginFuncTest.groovy index 599ad6d2df865..888c0cc83fc15 100644 --- a/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestTestPluginFuncTest.groovy +++ b/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestTestPluginFuncTest.groovy @@ -17,6 +17,11 @@ import org.gradle.testkit.runner.TaskOutcome @IgnoreIf({ os.isWindows() }) class LegacyYamlRestTestPluginFuncTest extends AbstractRestResourcesFuncTest { + def setup() { + buildApiRestrictionsDisabled = true + } + + def "yamlRestTest does nothing when there are no tests"() { given: // RestIntegTestTask not cc compatible due to diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java new file mode 100644 index 0000000000000..e9438eabadbb6 --- /dev/null +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java @@ -0,0 +1,220 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +package org.elasticsearch.gradle.internal; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.ListMultimap; + +import org.elasticsearch.gradle.internal.test.LegacyRestTestBasePlugin; +import org.gradle.api.GradleException; +import org.gradle.api.Project; +import org.gradle.api.provider.Property; +import org.gradle.api.services.BuildService; +import org.gradle.api.services.BuildServiceParameters; + +public abstract class RestrictedBuildApiService implements BuildService { + + public static final String BUILD_API_RESTRICTIONS_SYS_PROPERTY = "org.elasticsearch.gradle.build-api-restriction.disabled"; + + private static ListMultimap, String> usageWhitelist = createLegacyRestTestBasePluginUsage(); + + private static ListMultimap, String> createLegacyRestTestBasePluginUsage() { + ListMultimap, String> map = ArrayListMultimap.create(1, 200); + map.put(LegacyRestTestBasePlugin.class, ":docs"); + map.put(LegacyRestTestBasePlugin.class, ":distribution:docker"); + map.put(LegacyRestTestBasePlugin.class, ":modules:analysis-common"); + map.put(LegacyRestTestBasePlugin.class, ":modules:ingest-attachment"); + map.put(LegacyRestTestBasePlugin.class, ":modules:ingest-common"); + map.put(LegacyRestTestBasePlugin.class, ":modules:ingest-user-agent"); + map.put(LegacyRestTestBasePlugin.class, ":modules:kibana"); + map.put(LegacyRestTestBasePlugin.class, ":modules:lang-expression"); + map.put(LegacyRestTestBasePlugin.class, ":modules:lang-mustache"); + map.put(LegacyRestTestBasePlugin.class, ":modules:lang-painless"); + map.put(LegacyRestTestBasePlugin.class, ":modules:mapper-extras"); + map.put(LegacyRestTestBasePlugin.class, ":modules:parent-join"); + map.put(LegacyRestTestBasePlugin.class, ":modules:percolator"); + map.put(LegacyRestTestBasePlugin.class, ":modules:rank-eval"); + map.put(LegacyRestTestBasePlugin.class, ":modules:reindex"); + map.put(LegacyRestTestBasePlugin.class, ":modules:repository-s3"); + map.put(LegacyRestTestBasePlugin.class, ":modules:repository-url"); + map.put(LegacyRestTestBasePlugin.class, ":modules:runtime-fields-common"); + map.put(LegacyRestTestBasePlugin.class, ":modules:transport-netty4"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-icu"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-kuromoji"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-nori"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-phonetic"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-smartcn"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-stempel"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-ukrainian"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-azure-classic"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-ec2"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-gce"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:mapper-annotated-text"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:mapper-murmur3"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:repository-hdfs"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:store-smb"); + map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-rolling-upgrade-remote-cluster"); + map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-unavailable-clusters"); + map.put(LegacyRestTestBasePlugin.class, ":qa:logging-config"); + map.put(LegacyRestTestBasePlugin.class, ":qa:mixed-cluster"); + map.put(LegacyRestTestBasePlugin.class, ":qa:multi-cluster-search"); + map.put(LegacyRestTestBasePlugin.class, ":qa:remote-clusters"); + map.put(LegacyRestTestBasePlugin.class, ":qa:repository-multi-version"); + map.put(LegacyRestTestBasePlugin.class, ":qa:rolling-upgrade"); + map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-http"); + map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-disabled"); + map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-with-all-dependencies"); + map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-plugins"); + map.put(LegacyRestTestBasePlugin.class, ":qa:system-indices"); + map.put(LegacyRestTestBasePlugin.class, ":qa:unconfigured-node-name"); + map.put(LegacyRestTestBasePlugin.class, ":qa:verify-version-constants"); + map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-delayed-aggs"); + map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-die-with-dignity"); + map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-error-query"); + map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-latency-simulating-directory"); + map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-seek-tracking-directory"); + map.put(LegacyRestTestBasePlugin.class, ":test:yaml-rest-runner"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin"); + map.put(LegacyRestTestBasePlugin.class, ":distribution:archives:integ-test-zip"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:core"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:logstash"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-constant-keyword"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-unsigned-long"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-version"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:wildcard"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:kerberos-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:mixed-tier-cluster"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:password-protected-keystore"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:reindex-tests-with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:repository-old-versions"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:rolling-upgrade"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:rolling-upgrade-basic"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:rolling-upgrade-multi-cluster"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:runtime-fields:core-with-mapped"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:runtime-fields:core-with-search"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:saml-idp-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:security-example-spi-extension"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:security-setup-password-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-plugins"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-plugins-ssl"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-security-with-mustache"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:xpack-prefix-rest-compat"); + map.put(LegacyRestTestBasePlugin.class, ":modules:ingest-geoip:qa:file-based-update"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-ec2:qa:amazon-ec2"); + map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-gce:qa:gce"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-basic-license"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-full-license"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-restricted-trust"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:runtime-fields:with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:jira"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:pagerduty"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:slack"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:async-search:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:async-search:qa:security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:autoscaling:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:downgrade-to-basic-license"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:multi-cluster"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:non-compliant-license"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:restart"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:early-deprecation-rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:downsample:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:downsample:qa:with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:enrich:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:enrich:qa:rest-with-advanced-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:enrich:qa:rest-with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:ccs-rolling-upgrade"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:correctness"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:mixed-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:multi-cluster-with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:esql:qa:security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:esql:qa:server:multi-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:esql:qa:server:single-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:graph:qa:with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:identity-provider:qa:idp-rest-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ilm:qa:multi-cluster"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ilm:qa:multi-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ilm:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ilm:qa:with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:basic-multi-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:disabled"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:ml-with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:multi-cluster-tests-with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:native-multi-node-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:single-node-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:repositories-metering-api:qa:s3"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:hdfs"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:minio"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:s3"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:url"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:operator-privileges-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:profile"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:security-disabled"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:smoke-test-all-realms"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:tls-basic"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:multi-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:rolling-upgrade"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:multi-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:fs"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:license-enforcing"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:s3"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:hdfs"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:minio"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:s3"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:jdbc:multi-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:jdbc:no-sql"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:jdbc:single-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:jdbc:security:with-ssl"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:jdbc:security:without-ssl"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:mixed-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:multi-cluster-with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:multi-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:single-node"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:security:with-ssl"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:security:without-ssl"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:stack:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:text-structure:qa:text-structure-with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:multi-cluster-tests-with-security"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:multi-node-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:single-node-tests"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile:qa:multi-cluster"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:rest"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:with-monitoring"); + map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:with-security"); + return map; + } + + public void failOnUsageRestriction(Class aClass, Project project) { + if (getParameters().getDisabled().getOrElse(false)) { + return; + } + if (isSupported(aClass, project.getPath()) == false) { + throw new GradleException("Usage of deprecated " + aClass.getName() + " in " + project.getPath()); + } + } + + private boolean isSupported(Class aClass, String path) { + return usageWhitelist.get(aClass).contains(path); + } + + public abstract static class Params implements BuildServiceParameters { + public abstract Property getDisabled(); + } +} diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/LegacyRestTestBasePlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/LegacyRestTestBasePlugin.java index f270205111456..eacc5da6220ab 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/LegacyRestTestBasePlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/LegacyRestTestBasePlugin.java @@ -12,6 +12,7 @@ import org.elasticsearch.gradle.internal.ElasticsearchTestBasePlugin; import org.elasticsearch.gradle.internal.FixtureStop; import org.elasticsearch.gradle.internal.InternalTestClustersPlugin; +import org.elasticsearch.gradle.internal.RestrictedBuildApiService; import org.elasticsearch.gradle.internal.precommit.InternalPrecommitTasks; import org.elasticsearch.gradle.test.SystemPropertyCommandLineArgumentProvider; import org.elasticsearch.gradle.testclusters.ElasticsearchCluster; @@ -22,12 +23,14 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.plugins.JavaBasePlugin; +import org.gradle.api.provider.Provider; import org.gradle.api.provider.ProviderFactory; import org.gradle.api.tasks.Sync; import org.gradle.api.tasks.bundling.Zip; import javax.inject.Inject; +import static org.elasticsearch.gradle.internal.RestrictedBuildApiService.BUILD_API_RESTRICTIONS_SYS_PROPERTY; import static org.elasticsearch.gradle.plugin.BasePluginBuildPlugin.BUNDLE_PLUGIN_TASK_NAME; import static org.elasticsearch.gradle.plugin.BasePluginBuildPlugin.EXPLODED_BUNDLE_PLUGIN_TASK_NAME; @@ -52,6 +55,12 @@ public LegacyRestTestBasePlugin(ProviderFactory providerFactory) { @Override public void apply(Project project) { + Provider serviceProvider = project.getGradle() + .getSharedServices() + .registerIfAbsent("restrictedBuildAPI", RestrictedBuildApiService.class, spec -> { + spec.getParameters().getDisabled().set(Boolean.getBoolean(BUILD_API_RESTRICTIONS_SYS_PROPERTY)); + }); + serviceProvider.get().failOnUsageRestriction(getClass(), project); project.getPluginManager().apply(ElasticsearchJavaBasePlugin.class); project.getPluginManager().apply(ElasticsearchTestBasePlugin.class); project.getPluginManager().apply(InternalTestClustersPlugin.class); diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java index addf4f02f7f99..63433928feb5a 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java @@ -11,13 +11,12 @@ import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.VersionProperties; import org.elasticsearch.gradle.internal.ElasticsearchJavaBasePlugin; -import org.elasticsearch.gradle.internal.test.LegacyRestTestBasePlugin; import org.elasticsearch.gradle.internal.test.rest.CopyRestApiTask; import org.elasticsearch.gradle.internal.test.rest.CopyRestTestsTask; import org.elasticsearch.gradle.internal.test.rest.LegacyYamlRestTestPlugin; import org.elasticsearch.gradle.internal.test.rest.RestResourcesExtension; import org.elasticsearch.gradle.internal.test.rest.RestResourcesPlugin; -import org.elasticsearch.gradle.testclusters.TestClustersPlugin; +import org.elasticsearch.gradle.test.YamlRestTestPlugin; import org.elasticsearch.gradle.util.GradleUtils; import org.gradle.api.Plugin; import org.gradle.api.Project; @@ -77,20 +76,17 @@ public void apply(Project project) { final Path compatRestResourcesDir = Path.of("restResources").resolve("v" + COMPATIBLE_VERSION); final Path compatSpecsDir = compatRestResourcesDir.resolve("yamlSpecs"); final Path compatTestsDir = compatRestResourcesDir.resolve("yamlTests"); - + project.getPluginManager().apply(getBasePlugin()); project.getPluginManager().apply(ElasticsearchJavaBasePlugin.class); - project.getPluginManager().apply(TestClustersPlugin.class); - project.getPluginManager().apply(LegacyRestTestBasePlugin.class); project.getPluginManager().apply(RestResourcesPlugin.class); - project.getPluginManager().apply(getBasePlugin()); RestResourcesExtension extension = project.getExtensions().getByType(RestResourcesExtension.class); // create source set SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class); SourceSet yamlCompatTestSourceSet = sourceSets.create(SOURCE_SET_NAME); - SourceSet yamlTestSourceSet = sourceSets.getByName(LegacyYamlRestTestPlugin.SOURCE_SET_NAME); - GradleUtils.extendSourceSet(project, LegacyYamlRestTestPlugin.SOURCE_SET_NAME, SOURCE_SET_NAME); + SourceSet yamlTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.YAML_REST_TEST); + GradleUtils.extendSourceSet(project, YamlRestTestPlugin.YAML_REST_TEST, SOURCE_SET_NAME); // copy compatible rest specs Configuration bwcMinorConfig = project.getConfigurations().create(BWC_MINOR_CONFIG_NAME); diff --git a/build-tools-internal/version.properties b/build-tools-internal/version.properties index ce191115b82f8..274f6a98dc464 100644 --- a/build-tools-internal/version.properties +++ b/build-tools-internal/version.properties @@ -48,8 +48,8 @@ jmh = 1.26 # test dependencies # when updating this version, also update :qa:evil-tests -jimfs = 1.2 -jimfs_guava = 30.1-jre +jimfs = 1.3.0 +jimfs_guava = 32.1.1-jre # test framework networknt_json_schema_validator = 1.0.48 diff --git a/build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy b/build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy index 87459e63a53c1..8218829fe017b 100644 --- a/build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy +++ b/build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy @@ -9,7 +9,7 @@ package org.elasticsearch.gradle.fixtures import org.apache.commons.io.FileUtils -import org.elasticsearch.gradle.internal.test.ConfigurationCacheCompatibleAwareGradleRunner +import org.elasticsearch.gradle.internal.test.BuildConfigurationAwareGradleRunner import org.elasticsearch.gradle.internal.test.InternalAwareGradleRunner import org.elasticsearch.gradle.internal.test.NormalizeOutputGradleRunner import org.elasticsearch.gradle.internal.test.TestResultExtension @@ -39,7 +39,8 @@ abstract class AbstractGradleFuncTest extends Specification { File propertiesFile File projectDir - boolean configurationCacheCompatible = true + protected boolean configurationCacheCompatible = true + protected boolean buildApiRestrictionsDisabled = false def setup() { projectDir = testProjectDir.root @@ -79,16 +80,17 @@ abstract class AbstractGradleFuncTest extends Specification { GradleRunner gradleRunner(File projectDir, Object... arguments) { return new NormalizeOutputGradleRunner( - new ConfigurationCacheCompatibleAwareGradleRunner( + new BuildConfigurationAwareGradleRunner( new InternalAwareGradleRunner( - GradleRunner.create() - .withDebug(ManagementFactory.getRuntimeMXBean().getInputArguments() - .toString().indexOf("-agentlib:jdwp") > 0 - ) - .withProjectDir(projectDir) - .withPluginClasspath() - .forwardOutput() - ), configurationCacheCompatible), + GradleRunner.create() + .withDebug(ManagementFactory.getRuntimeMXBean().getInputArguments() + .toString().indexOf("-agentlib:jdwp") > 0 + ) + .withProjectDir(projectDir) + .withPluginClasspath() + .forwardOutput() + ), configurationCacheCompatible, + buildApiRestrictionsDisabled) ).withArguments(arguments.collect { it.toString() }) } diff --git a/build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/RestrictedBuildServiceAwareGradleRunner.groovy b/build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/RestrictedBuildServiceAwareGradleRunner.groovy new file mode 100644 index 0000000000000..d8739b9b380cf --- /dev/null +++ b/build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/RestrictedBuildServiceAwareGradleRunner.groovy @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +package org.elasticsearch.gradle.fixtures + +import org.elasticsearch.gradle.internal.test.InternalAwareGradleRunner + +class RestrictedBuildServiceAwareGradleRunner { + RestrictedBuildServiceAwareGradleRunner(InternalAwareGradleRunner delegate) { + + } +} diff --git a/build-tools/src/testFixtures/java/org/elasticsearch/gradle/internal/test/ConfigurationCacheCompatibleAwareGradleRunner.java b/build-tools/src/testFixtures/java/org/elasticsearch/gradle/internal/test/BuildConfigurationAwareGradleRunner.java similarity index 84% rename from build-tools/src/testFixtures/java/org/elasticsearch/gradle/internal/test/ConfigurationCacheCompatibleAwareGradleRunner.java rename to build-tools/src/testFixtures/java/org/elasticsearch/gradle/internal/test/BuildConfigurationAwareGradleRunner.java index 74b92f2ab1389..1a2a7a564b4f1 100644 --- a/build-tools/src/testFixtures/java/org/elasticsearch/gradle/internal/test/ConfigurationCacheCompatibleAwareGradleRunner.java +++ b/build-tools/src/testFixtures/java/org/elasticsearch/gradle/internal/test/BuildConfigurationAwareGradleRunner.java @@ -23,15 +23,19 @@ import java.util.Map; /** - * A Gradle runner that delegates to another runner, optionally enabling the configuring cache parameter. + * A Gradle runner that delegates to another runner, optionally configuring + * - the configuring cache parameter + * - the internal restricted build api service */ -public class ConfigurationCacheCompatibleAwareGradleRunner extends GradleRunner { - private GradleRunner delegate; - private boolean ccCompatible; +public class BuildConfigurationAwareGradleRunner extends GradleRunner { + private final GradleRunner delegate; + private final boolean ccCompatible; + private final boolean buildApiRestrictionsDisabled; - public ConfigurationCacheCompatibleAwareGradleRunner(GradleRunner delegate, boolean ccCompatible) { + public BuildConfigurationAwareGradleRunner(GradleRunner delegate, boolean ccCompatible, boolean buildApiRestrictionsDisabled) { this.delegate = delegate; this.ccCompatible = ccCompatible; + this.buildApiRestrictionsDisabled = buildApiRestrictionsDisabled; } @Override @@ -76,11 +80,13 @@ public List getArguments() { @Override public GradleRunner withArguments(List arguments) { - List effectiveArgs = arguments; + List effectiveArgs = new ArrayList<>(arguments); if (ccCompatible) { - effectiveArgs = new ArrayList<>(arguments); effectiveArgs.add("--configuration-cache"); } + if (buildApiRestrictionsDisabled) { + effectiveArgs.add("-Dorg.elasticsearch.gradle.build-api-restriction.disabled=" + buildApiRestrictionsDisabled); + } delegate.withArguments(effectiveArgs); return this; } diff --git a/distribution/tools/geoip-cli/build.gradle b/distribution/tools/geoip-cli/build.gradle index ebc34550a6625..cc7ac34a8acb0 100644 --- a/distribution/tools/geoip-cli/build.gradle +++ b/distribution/tools/geoip-cli/build.gradle @@ -17,5 +17,5 @@ dependencies { compileOnly project(":libs:elasticsearch-cli") compileOnly project(":libs:elasticsearch-x-content") testImplementation project(":test:framework") - testImplementation "org.apache.commons:commons-compress:1.21" + testImplementation "org.apache.commons:commons-compress:1.24.0" } diff --git a/docs/changelog/97642.yaml b/docs/changelog/97642.yaml new file mode 100644 index 0000000000000..cf519e04e2d38 --- /dev/null +++ b/docs/changelog/97642.yaml @@ -0,0 +1,5 @@ +pr: 97642 +summary: fix fuzzy query rewrite parameter not work +area: Search +type: bug +issues: [] diff --git a/docs/changelog/99281.yaml b/docs/changelog/99281.yaml deleted file mode 100644 index 12d018c63a863..0000000000000 --- a/docs/changelog/99281.yaml +++ /dev/null @@ -1,5 +0,0 @@ -pr: 99281 -summary: Fix PIT when resolving with deleted indices -area: Search -type: bug -issues: [] diff --git a/docs/changelog/99470.yaml b/docs/changelog/99470.yaml new file mode 100644 index 0000000000000..3e784595cc6ac --- /dev/null +++ b/docs/changelog/99470.yaml @@ -0,0 +1,5 @@ +pr: 99470 +summary: "ESQL: Improve log messages" +area: ES|QL +type: enhancement +issues: [] diff --git a/docs/changelog/99480.yaml b/docs/changelog/99480.yaml deleted file mode 100644 index 08dcdceca60b0..0000000000000 --- a/docs/changelog/99480.yaml +++ /dev/null @@ -1,6 +0,0 @@ -pr: 99480 -summary: Fix deadlock between Cache.put and Cache.invalidateAll -area: Infra/Core -type: bug -issues: - - 99326 diff --git a/docs/changelog/99490.yaml b/docs/changelog/99490.yaml deleted file mode 100644 index 07fd913f2c1c4..0000000000000 --- a/docs/changelog/99490.yaml +++ /dev/null @@ -1,6 +0,0 @@ -pr: 99490 -summary: Fork computation in `TransportGetShutdownStatusAction` -area: Infra/Node Lifecycle -type: bug -issues: - - 99487 diff --git a/docs/changelog/99491.yaml b/docs/changelog/99491.yaml deleted file mode 100644 index dfeab5dbbad6d..0000000000000 --- a/docs/changelog/99491.yaml +++ /dev/null @@ -1,6 +0,0 @@ -pr: 99491 -summary: Use long in Centroid count -area: Aggregations -type: bug -issues: - - 80153 diff --git a/docs/changelog/99601.yaml b/docs/changelog/99601.yaml new file mode 100644 index 0000000000000..9deba859a5cef --- /dev/null +++ b/docs/changelog/99601.yaml @@ -0,0 +1,6 @@ +pr: 99601 +summary: "ESQL: continue resolving attributes for Eval" +area: ES|QL +type: bug +issues: + - 99576 diff --git a/docs/reference/esql/esql-functions.asciidoc b/docs/reference/esql/esql-functions.asciidoc index 1e29d312906ae..9d656760fe12e 100644 --- a/docs/reference/esql/esql-functions.asciidoc +++ b/docs/reference/esql/esql-functions.asciidoc @@ -26,6 +26,7 @@ these functions: * <> * <> * <> +* <> * <> * <> * <> @@ -89,6 +90,7 @@ include::functions/date_format.asciidoc[] include::functions/date_parse.asciidoc[] include::functions/date_trunc.asciidoc[] include::functions/e.asciidoc[] +include::functions/ends_with.asciidoc[] include::functions/floor.asciidoc[] include::functions/greatest.asciidoc[] include::functions/is_finite.asciidoc[] diff --git a/docs/reference/esql/functions/ends_with.asciidoc b/docs/reference/esql/functions/ends_with.asciidoc new file mode 100644 index 0000000000000..baa96a378ab37 --- /dev/null +++ b/docs/reference/esql/functions/ends_with.asciidoc @@ -0,0 +1,20 @@ +[[esql-ends_with]] +=== `ENDS_WITH` +[.text-center] +image::esql/functions/signature/ends_with.svg[Embedded,opts=inline] + +Returns a boolean that indicates whether a keyword string ends with another +string: + +[source.merge.styled,esql] +---- +include::{esql-specs}/string.csv-spec[tag=endsWith] +---- +[%header.monospaced.styled,format=dsv,separator=|] +|=== +include::{esql-specs}/string.csv-spec[tag=endsWith-result] +|=== + +Supported types: + +include::types/ends_with.asciidoc[] diff --git a/docs/reference/esql/functions/signature/ends_with.svg b/docs/reference/esql/functions/signature/ends_with.svg new file mode 100644 index 0000000000000..bf2cb47ed0be0 --- /dev/null +++ b/docs/reference/esql/functions/signature/ends_with.svg @@ -0,0 +1 @@ +ENDS_WITH(arg1,arg2) \ No newline at end of file diff --git a/docs/reference/esql/functions/types/ends_with.asciidoc b/docs/reference/esql/functions/types/ends_with.asciidoc new file mode 100644 index 0000000000000..6c406b80c0cad --- /dev/null +++ b/docs/reference/esql/functions/types/ends_with.asciidoc @@ -0,0 +1,5 @@ +[%header.monospaced.styled,format=dsv,separator=|] +|=== +arg1 | arg2 | result +keyword | keyword | boolean +|=== diff --git a/docs/reference/release-notes.asciidoc b/docs/reference/release-notes.asciidoc index df8c167a1ae88..cb02320529457 100644 --- a/docs/reference/release-notes.asciidoc +++ b/docs/reference/release-notes.asciidoc @@ -7,6 +7,7 @@ This section summarizes the changes in each release. * <> +* <> * <> * <> * <> @@ -50,6 +51,7 @@ This section summarizes the changes in each release. -- include::release-notes/8.11.0.asciidoc[] +include::release-notes/8.10.1.asciidoc[] include::release-notes/8.10.0.asciidoc[] include::release-notes/8.9.2.asciidoc[] include::release-notes/8.9.1.asciidoc[] diff --git a/docs/reference/release-notes/8.10.1.asciidoc b/docs/reference/release-notes/8.10.1.asciidoc new file mode 100644 index 0000000000000..de890ccadd772 --- /dev/null +++ b/docs/reference/release-notes/8.10.1.asciidoc @@ -0,0 +1,22 @@ +[[release-notes-8.10.1]] +== {es} version 8.10.1 + +Also see <>. + +[[bug-8.10.1]] +[float] +=== Bug fixes + +Aggregations:: +* Use long in Centroid count {es-pull}99491[#99491] (issue: {es-issue}80153[#80153]) + +Infra/Core:: +* Fix deadlock between Cache.put and Cache.invalidateAll {es-pull}99480[#99480] (issue: {es-issue}99326[#99326]) + +Infra/Node Lifecycle:: +* Fork computation in `TransportGetShutdownStatusAction` {es-pull}99490[#99490] (issue: {es-issue}99487[#99487]) + +Search:: +* Fix PIT when resolving with deleted indices {es-pull}99281[#99281] + + diff --git a/docs/reference/search/profile.asciidoc b/docs/reference/search/profile.asciidoc index 7f9cf34ba7dad..52dfb91475c53 100644 --- a/docs/reference/search/profile.asciidoc +++ b/docs/reference/search/profile.asciidoc @@ -740,7 +740,7 @@ The API returns the following result: "time_in_nanos": 22577 }, { - "name": "BucketCollectorWrapper: [BucketCollectorWrapper[bucketCollector=[my_scoped_agg, my_global_agg]]]", + "name": "AggregatorCollector: [my_scoped_agg, my_global_agg]", "reason": "aggregation", "time_in_nanos": 867617 } diff --git a/docs/reference/snapshot-restore/repository-s3.asciidoc b/docs/reference/snapshot-restore/repository-s3.asciidoc index c34b295f9bd1a..16171e2e71631 100644 --- a/docs/reference/snapshot-restore/repository-s3.asciidoc +++ b/docs/reference/snapshot-restore/repository-s3.asciidoc @@ -226,16 +226,16 @@ emulate S3's behaviour in full. The `repository-s3` type requires full compatibility with S3. In particular it must support the same set of API endpoints, return the same errors in case of failures, and offer consistency and performance at least as good as S3 even when accessed concurrently by -multiple nodes. Incompatible error codes, consistency or performance may be -particularly hard to track down since errors, consistency failures, and -performance issues are usually rare and hard to reproduce. +multiple nodes. You will need to work with the supplier of your storage system +to address any incompatibilities you encounter. You can perform some basic checks of the suitability of your storage system using the {ref}/repo-analysis-api.html[repository analysis API]. If this API does not complete successfully, or indicates poor performance, then your storage system is not fully compatible with AWS S3 and therefore unsuitable for -use as a snapshot repository. You will need to work with the supplier of your -storage system to address any incompatibilities you encounter. +use as a snapshot repository. However, these checks do not guarantee full +compatibility. Incompatible error codes and consistency or performance issues +may be rare and hard to reproduce. [[repository-s3-repository]] ==== Repository settings diff --git a/gradle/build.versions.toml b/gradle/build.versions.toml index 532e75c39d3c9..97cefe4df8f67 100644 --- a/gradle/build.versions.toml +++ b/gradle/build.versions.toml @@ -7,7 +7,7 @@ spock = "2.1-groovy-3.0" [libraries] ant = "org.apache.ant:ant:1.10.12" antlrst4 = "org.antlr:ST4:4.3.4" -apache-compress = "org.apache.commons:commons-compress:1.21" +apache-compress = "org.apache.commons:commons-compress:1.24.0" apache-rat = "org.apache.rat:apache-rat:0.11" asm = { group = "org.ow2.asm", name="asm", version.ref="asm" } asm-tree = { group = "org.ow2.asm", name="asm-tree", version.ref="asm" } diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index ccb7b4dea36ee..6cd8d56be9530 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -481,6 +481,11 @@ + + + + + @@ -521,11 +526,6 @@ - - - - - @@ -536,6 +536,11 @@ + + + + + @@ -606,9 +611,9 @@ - - - + + + @@ -1685,9 +1690,9 @@ - - - + + + @@ -2886,6 +2891,11 @@ + + + + + diff --git a/modules/data-streams/src/test/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleServiceTests.java b/modules/data-streams/src/test/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleServiceTests.java index 3a5afd2042565..5b73d94be578a 100644 --- a/modules/data-streams/src/test/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleServiceTests.java +++ b/modules/data-streams/src/test/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleServiceTests.java @@ -923,7 +923,7 @@ public void testDownsampling() throws Exception { DataStreamLifecycle.newBuilder() .downsampling( new Downsampling( - List.of(new Round(TimeValue.timeValueMillis(0), new DownsampleConfig(new DateHistogramInterval("1s")))) + List.of(new Round(TimeValue.timeValueMillis(0), new DownsampleConfig(new DateHistogramInterval("5m")))) ) ) .dataRetention(TimeValue.MAX_VALUE) @@ -977,7 +977,7 @@ public void testDownsampling() throws Exception { String downsampleIndexName = DownsampleConfig.generateDownsampleIndexName( DOWNSAMPLED_INDEX_PREFIX, state.metadata().index(firstGenIndex), - new DateHistogramInterval("1s") + new DateHistogramInterval("5m") ); { // let's simulate the in-progress downsampling @@ -1100,7 +1100,7 @@ public void testDownsamplingWhenTargetIndexNameClashYieldsException() throws Exc DataStreamLifecycle.newBuilder() .downsampling( new Downsampling( - List.of(new Round(TimeValue.timeValueMillis(0), new DownsampleConfig(new DateHistogramInterval("1s")))) + List.of(new Round(TimeValue.timeValueMillis(0), new DownsampleConfig(new DateHistogramInterval("5m")))) ) ) .dataRetention(TimeValue.MAX_VALUE) @@ -1129,7 +1129,7 @@ public void testDownsamplingWhenTargetIndexNameClashYieldsException() throws Exc String downsampleIndexName = DownsampleConfig.generateDownsampleIndexName( DOWNSAMPLED_INDEX_PREFIX, state.metadata().index(firstGenIndexName), - new DateHistogramInterval("1s") + new DateHistogramInterval("5m") ); Metadata.Builder newMetadata = Metadata.builder(state.metadata()) .put( diff --git a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/10_explain_lifecycle.yml b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/10_explain_lifecycle.yml index 66901f93f522d..51f2980671add 100644 --- a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/10_explain_lifecycle.yml +++ b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/10_explain_lifecycle.yml @@ -1,8 +1,8 @@ --- "Explain backing index lifecycle": - skip: - version: " - 8.9.99" - reason: "Explain data stream lifecycle API was updated in 8.10" + version: " - 8.10.99" + reason: "Data stream lifecycle was GA in 8.11" features: allowed_warnings - do: allowed_warnings: diff --git a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/190_create_data_stream_with_lifecycle.yml b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/190_create_data_stream_with_lifecycle.yml index 7238cebaf1d7b..0e4bbd795c18a 100644 --- a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/190_create_data_stream_with_lifecycle.yml +++ b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/190_create_data_stream_with_lifecycle.yml @@ -1,8 +1,8 @@ --- "Create data stream with lifecycle": - skip: - version: " - 8.9.99" - reason: "data stream lifecycle in index templates was added after 8.10" + version: " - 8.10.99" + reason: "Data stream lifecycle was GA in 8.11" features: allowed_warnings - do: allowed_warnings: diff --git a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/30_not_found.yml b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/30_not_found.yml index 41f698327bf8c..e0646ba27751e 100644 --- a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/30_not_found.yml +++ b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/lifecycle/30_not_found.yml @@ -1,8 +1,8 @@ setup: - skip: features: allowed_warnings - version: " - 8.9.99" - reason: "Data stream lifecycles only supported in 8.10+" + version: " - 8.10.99" + reason: "Data stream lifecycle was GA in 8.11" - do: allowed_warnings: - "index template [my-lifecycle] has index patterns [my-data-stream-1] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-lifecycle] will take precedence during new index creation" diff --git a/modules/ingest-attachment/build.gradle b/modules/ingest-attachment/build.gradle index 09e0184a35716..461474fa68dca 100644 --- a/modules/ingest-attachment/build.gradle +++ b/modules/ingest-attachment/build.gradle @@ -76,7 +76,7 @@ dependencies { // MS Office api "org.apache.poi:poi-scratchpad:${versions.poi}" // Apple iWork - api 'org.apache.commons:commons-compress:1.22' + api 'org.apache.commons:commons-compress:1.24.0' // Outlook documents api "org.apache.james:apache-mime4j-core:${versions.mime4j}" api "org.apache.james:apache-mime4j-dom:${versions.mime4j}" diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java index 5f9936bd0c96d..fb580591ac8c7 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java @@ -344,7 +344,7 @@ public void testAppendingToTheSameField() { execProcessor(processor, ingestDocument, (result, e) -> {}); assertThat(testProcessor.getInvokedCounter(), equalTo(2)); ingestDocument.removeField("_ingest._value"); - assertThat(ingestDocument, equalTo(originalIngestDocument)); + assertIngestDocument(ingestDocument, originalIngestDocument); } public void testRemovingFromTheSameField() { @@ -355,7 +355,7 @@ public void testRemovingFromTheSameField() { execProcessor(processor, ingestDocument, (result, e) -> {}); assertThat(testProcessor.getInvokedCounter(), equalTo(2)); ingestDocument.removeField("_ingest._value"); - assertThat(ingestDocument, equalTo(originalIngestDocument)); + assertIngestDocument(ingestDocument, originalIngestDocument); } public void testMapIteration() { diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java index da71cb12a21f0..1e40345208a1b 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java @@ -114,7 +114,7 @@ public void testMatchWithoutCaptures() throws Exception { MatcherWatchdog.noop() ); processor.execute(doc); - assertThat(doc, equalTo(originalDoc)); + assertIngestDocument(doc, originalDoc); } public void testNullField() { diff --git a/qa/evil-tests/build.gradle b/qa/evil-tests/build.gradle index 29eb7843101f5..ef040b002cd39 100644 --- a/qa/evil-tests/build.gradle +++ b/qa/evil-tests/build.gradle @@ -16,7 +16,7 @@ apply plugin: 'elasticsearch.internal-testclusters' apply plugin: 'elasticsearch.standalone-test' dependencies { - testImplementation "com.google.jimfs:jimfs:1.2" + testImplementation "com.google.jimfs:jimfs:1.3.0" testImplementation "com.google.guava:guava:${versions.jimfs_guava}" testImplementation project(":test:framework") testImplementation project(':distribution:tools:plugin-cli') diff --git a/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedFullClusterRestartTestCase.java b/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedFullClusterRestartTestCase.java index 4609b27db2909..eef8f62eedd98 100644 --- a/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedFullClusterRestartTestCase.java +++ b/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedFullClusterRestartTestCase.java @@ -12,24 +12,30 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; import com.carrotsearch.randomizedtesting.annotations.TestCaseOrdering; +import org.elasticsearch.client.Request; +import org.elasticsearch.client.Response; import org.elasticsearch.index.IndexVersion; import org.elasticsearch.test.cluster.ElasticsearchCluster; import org.elasticsearch.test.cluster.util.Version; import org.elasticsearch.test.rest.ESRestTestCase; +import org.elasticsearch.test.rest.ObjectPath; import org.junit.AfterClass; import org.junit.Before; import java.util.Arrays; import java.util.Locale; +import java.util.Map; import static org.elasticsearch.upgrades.FullClusterRestartUpgradeStatus.OLD; import static org.elasticsearch.upgrades.FullClusterRestartUpgradeStatus.UPGRADED; -import static org.hamcrest.Matchers.lessThan; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.notNullValue; @TestCaseOrdering(FullClusterRestartTestOrdering.class) public abstract class ParameterizedFullClusterRestartTestCase extends ESRestTestCase { private static final Version MINIMUM_WIRE_COMPATIBLE_VERSION = Version.fromString("7.17.0"); private static final Version OLD_CLUSTER_VERSION = Version.fromString(System.getProperty("tests.old_cluster_version")); + private static IndexVersion oldIndexVersion; private static boolean upgradeFailed = false; private static boolean upgraded = false; private final FullClusterRestartUpgradeStatus requestedUpgradeStatus; @@ -43,6 +49,39 @@ public static Iterable parameters() throws Exception { return Arrays.stream(FullClusterRestartUpgradeStatus.values()).map(v -> new Object[] { v }).toList(); } + @Before + public void extractOldIndexVersion() throws Exception { + if (upgraded == false) { + IndexVersion indexVersion = null; // these should all be the same version + + Request request = new Request("GET", "_nodes"); + request.addParameter("filter_path", "nodes.*.index_version,nodes.*.name"); + Response response = client().performRequest(request); + ObjectPath objectPath = ObjectPath.createFromResponse(response); + Map nodeMap = objectPath.evaluate("nodes"); + for (String id : nodeMap.keySet()) { + Number ix = objectPath.evaluate("nodes." + id + ".index_version"); + IndexVersion version; + if (ix != null) { + version = IndexVersion.fromId(ix.intValue()); + } else { + // it doesn't have index version (pre 8.11) - just infer it from the release version + version = IndexVersion.fromId(getOldClusterVersion().id); + } + + if (indexVersion == null) { + indexVersion = version; + } else { + String name = objectPath.evaluate("nodes." + id + ".name"); + assertThat("Node " + name + " has a different index version to other nodes", version, equalTo(indexVersion)); + } + } + + assertThat("Index version could not be read", indexVersion, notNullValue()); + oldIndexVersion = indexVersion; + } + } + @Before public void maybeUpgrade() throws Exception { if (upgraded == false && requestedUpgradeStatus == UPGRADED) { @@ -81,13 +120,8 @@ public static org.elasticsearch.Version getOldClusterVersion() { } public static IndexVersion getOldClusterIndexVersion() { - var version = getOldClusterVersion(); - if (version.equals(org.elasticsearch.Version.CURRENT)) { - return IndexVersion.current(); - } else { - assertThat("Index version needs to be added to restart test parameters", version, lessThan(org.elasticsearch.Version.V_8_11_0)); - return IndexVersion.fromId(version.id); - } + assert oldIndexVersion != null; + return oldIndexVersion; } public static Version getOldClusterTestVersion() { diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.delete_index_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.delete_index_template.json index a07d654078cfc..e920ec09351ec 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.delete_index_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.delete_index_template.json @@ -1,7 +1,7 @@ { "indices.delete_index_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html", "description":"Deletes an index template." }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.delete_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.delete_template.json index 7d79c2aba13c3..b0471b9dafa7e 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.delete_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.delete_template.json @@ -1,7 +1,7 @@ { "indices.delete_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template-v1.html", "description":"Deletes an index template." }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.exists_index_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.exists_index_template.json index dc0f9ed59c665..0163b0bbbd8ce 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.exists_index_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.exists_index_template.json @@ -1,7 +1,7 @@ { "indices.exists_index_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html", "description":"Returns information about whether a particular index template exists." }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.exists_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.exists_template.json index 9d2b6b15cc054..77cb62b022515 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.exists_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.exists_template.json @@ -1,7 +1,7 @@ { "indices.exists_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html", "description":"Returns information about whether a particular index template exists." }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_index_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_index_template.json index 7b24fec14c4a0..4ed82c3bbc5eb 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_index_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_index_template.json @@ -1,7 +1,7 @@ { "indices.get_index_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html", "description":"Returns an index template." }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_template.json index e1f7c1c0202a5..963d9a4cb670e 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_template.json @@ -1,7 +1,7 @@ { "indices.get_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html", "description":"Returns an index template." }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_index_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_index_template.json index 542f316ad7ab8..00f6ac88eab45 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_index_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_index_template.json @@ -1,7 +1,7 @@ { "indices.put_index_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html", "description":"Creates or updates an index template." }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_template.json index e87c625d1cfb1..7e4afb14e06e6 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_template.json @@ -1,7 +1,7 @@ { "indices.put_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html", "description":"Creates or updates an index template." }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_index_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_index_template.json index 152fae82f070a..e12b5116ffcdf 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_index_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_index_template.json @@ -1,7 +1,7 @@ { "indices.simulate_index_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html", "description": "Simulate matching the given index name against the index templates in the system" }, "stability":"stable", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_template.json index 763e46e48fef2..7958454564c83 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_template.json @@ -1,7 +1,7 @@ { "indices.simulate_template":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html", "description": "Simulate resolving the given template name or body" }, "stability":"stable", diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.component_template/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.component_template/10_basic.yml index ab2f522eb3631..500207e969146 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.component_template/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.component_template/10_basic.yml @@ -117,8 +117,8 @@ --- "Add data stream lifecycle": - skip: - version: " - 8.9.99" - reason: "Data stream lifecycle template was updated after 8.9" + version: " - 8.10.99" + reason: "Data stream lifecycle was GA in 8.11" - do: cluster.put_component_template: @@ -145,8 +145,8 @@ --- "Get data stream lifecycle with default rollover": - skip: - version: " - 8.9.99" - reason: "Data stream lifecycle template was added after 8.9" + version: " - 8.10.99" + reason: "Data stream lifecycle was GA in 8.11" - do: cluster.put_component_template: diff --git a/server/src/internalClusterTest/java/org/elasticsearch/repositories/blobstore/BlobStoreSizeLimitIT.java b/server/src/internalClusterTest/java/org/elasticsearch/repositories/blobstore/BlobStoreSizeLimitIT.java index 73ad2737f1f10..ffe6133e034bc 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/repositories/blobstore/BlobStoreSizeLimitIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/repositories/blobstore/BlobStoreSizeLimitIT.java @@ -14,11 +14,14 @@ import org.elasticsearch.repositories.RepositoryException; import org.elasticsearch.repositories.fs.FsRepository; import org.elasticsearch.snapshots.AbstractSnapshotIntegTestCase; +import org.elasticsearch.snapshots.SnapshotException; import org.hamcrest.Matchers; import java.util.List; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.instanceOf; public class BlobStoreSizeLimitIT extends AbstractSnapshotIntegTestCase { @@ -32,7 +35,11 @@ public void testBlobStoreSizeIsLimited() throws Exception { ); final List snapshotNames = createNSnapshots(repoName, maxSnapshots); final ActionFuture failingSnapshotFuture = startFullSnapshot(repoName, "failing-snapshot"); - final RepositoryException repositoryException = expectThrows(RepositoryException.class, failingSnapshotFuture::actionGet); + final SnapshotException snapshotException = expectThrows(SnapshotException.class, failingSnapshotFuture::actionGet); + assertThat(snapshotException.getRepositoryName(), equalTo(repoName)); + assertThat(snapshotException.getSnapshotName(), equalTo("failing-snapshot")); + assertThat(snapshotException.getCause(), instanceOf(RepositoryException.class)); + final RepositoryException repositoryException = (RepositoryException) snapshotException.getCause(); assertThat( repositoryException.getMessage(), Matchers.endsWith( diff --git a/server/src/main/java/org/elasticsearch/Build.java b/server/src/main/java/org/elasticsearch/Build.java index acb61e5fb46b6..c34a9737bf799 100644 --- a/server/src/main/java/org/elasticsearch/Build.java +++ b/server/src/main/java/org/elasticsearch/Build.java @@ -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; @@ -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(); } } diff --git a/server/src/main/java/org/elasticsearch/TransportVersion.java b/server/src/main/java/org/elasticsearch/TransportVersion.java index efb3cca9a7c59..2aae6befb673a 100644 --- a/server/src/main/java/org/elasticsearch/TransportVersion.java +++ b/server/src/main/java/org/elasticsearch/TransportVersion.java @@ -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. @@ -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; } diff --git a/server/src/main/java/org/elasticsearch/Version.java b/server/src/main/java/org/elasticsearch/Version.java index a1bb7df3fef0a..43b4d2c8bb37a 100644 --- a/server/src/main/java/org/elasticsearch/Version.java +++ b/server/src/main/java/org/elasticsearch/Version.java @@ -149,6 +149,7 @@ public class Version implements VersionId, ToXContentFragment { public static final Version V_8_9_2 = new Version(8_09_02_99); public static final Version V_8_10_0 = new Version(8_10_00_99); public static final Version V_8_10_1 = new Version(8_10_01_99); + public static final Version V_8_10_2 = new Version(8_10_02_99); public static final Version V_8_11_0 = new Version(8_11_00_99); public static final Version CURRENT = V_8_11_0; diff --git a/server/src/main/java/org/elasticsearch/action/ActionModule.java b/server/src/main/java/org/elasticsearch/action/ActionModule.java index 5683ace63ba3b..f0b755f1108cd 100644 --- a/server/src/main/java/org/elasticsearch/action/ActionModule.java +++ b/server/src/main/java/org/elasticsearch/action/ActionModule.java @@ -274,7 +274,6 @@ import org.elasticsearch.action.update.UpdateAction; import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.NamedRegistry; @@ -509,7 +508,7 @@ public class ActionModule extends AbstractModule { private final RequestValidators indicesAliasesRequestRequestValidators; private final ThreadPool threadPool; private final ReservedClusterStateService reservedClusterStateService; - private final boolean serverlessEnabled; + private final RestExtension restExtension; public ActionModule( Settings settings, @@ -525,7 +524,8 @@ public ActionModule( SystemIndices systemIndices, Tracer tracer, ClusterService clusterService, - List> reservedStateHandlers + List> reservedStateHandlers, + RestExtension restExtension ) { this.settings = settings; this.indexNameExpressionResolver = indexNameExpressionResolver; @@ -534,7 +534,6 @@ public ActionModule( this.settingsFilter = settingsFilter; this.actionPlugins = actionPlugins; this.threadPool = threadPool; - this.serverlessEnabled = DiscoveryNode.isServerless(); actions = setupActions(actionPlugins); actionFilters = setupActionFilters(actionPlugins); autoCreateIndex = new AutoCreateIndex(settings, clusterSettings, indexNameExpressionResolver, systemIndices); @@ -572,6 +571,7 @@ public ActionModule( restController = new RestController(restInterceptor, nodeClient, circuitBreakerService, usageService, tracer); } reservedClusterStateService = new ReservedClusterStateService(clusterService, reservedStateHandlers); + this.restExtension = restExtension; } private static T getRestServerComponent( @@ -851,15 +851,10 @@ private static ActionFilters setupActionFilters(List actionPlugins public void initRestHandlers(Supplier nodesInCluster) { List catActions = new ArrayList<>(); - var restExtension = RestExtension.load(() -> new RestExtension() { - @Override - public Predicate getCatActionsFilter() { - return action -> true; - } - }); Predicate catActionsFilter = restExtension.getCatActionsFilter(); + Predicate restFilter = restExtension.getActionsFilter(); Consumer registerHandler = handler -> { - if (shouldKeepRestHandler(handler)) { + if (restFilter.test(handler)) { if (handler instanceof AbstractCatAction catAction && catActionsFilter.test(catAction)) { catActions.add(catAction); } @@ -1066,16 +1061,6 @@ public Predicate 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); diff --git a/server/src/main/java/org/elasticsearch/action/ingest/WriteableIngestDocument.java b/server/src/main/java/org/elasticsearch/action/ingest/WriteableIngestDocument.java index 40f8da6f7efaa..a77d0bf7e2b01 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/WriteableIngestDocument.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/WriteableIngestDocument.java @@ -25,7 +25,6 @@ import java.io.IOException; import java.time.ZonedDateTime; import java.util.Map; -import java.util.Objects; import static org.elasticsearch.xcontent.ConstructingObjectParser.constructorArg; import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstructorArg; @@ -140,23 +139,6 @@ public static WriteableIngestDocument fromXContent(XContentParser parser) { return PARSER.apply(parser, null); } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WriteableIngestDocument that = (WriteableIngestDocument) o; - return Objects.equals(ingestDocument, that.ingestDocument); - } - - @Override - public int hashCode() { - return Objects.hash(ingestDocument); - } - @Override public String toString() { return ingestDocument.toString(); diff --git a/server/src/main/java/org/elasticsearch/action/support/SubscribableListener.java b/server/src/main/java/org/elasticsearch/action/support/SubscribableListener.java index 96b54a951ccc9..cebb4ed6e06e6 100644 --- a/server/src/main/java/org/elasticsearch/action/support/SubscribableListener.java +++ b/server/src/main/java/org/elasticsearch/action/support/SubscribableListener.java @@ -12,11 +12,13 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchTimeoutException; import org.elasticsearch.action.ActionListener; +import org.elasticsearch.common.CheckedBiConsumer; import org.elasticsearch.common.Strings; import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.ListenableFuture; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.util.concurrent.UncategorizedExecutionException; +import org.elasticsearch.core.CheckedConsumer; import org.elasticsearch.core.Nullable; import org.elasticsearch.core.TimeValue; import org.elasticsearch.threadpool.ThreadPool; @@ -29,7 +31,7 @@ /** * An {@link ActionListener} to which other {@link ActionListener} instances can subscribe, such that when this listener is completed it * fans-out its result to the subscribed listeners. - * + *

* Similar to {@link ListenableActionFuture} and {@link ListenableFuture} except for its handling of exceptions: if this listener is * completed exceptionally then the exception is passed to subscribed listeners without modification. */ @@ -38,6 +40,41 @@ public class SubscribableListener implements ActionListener { private static final Logger logger = LogManager.getLogger(SubscribableListener.class); private static final Object EMPTY = new Object(); + /** + * Create a {@link SubscribableListener} which is incomplete. + */ + public SubscribableListener() { + this(EMPTY); + } + + /** + * Create a {@link SubscribableListener} which has already succeeded with the given result. + */ + public static SubscribableListener newSucceeded(T result) { + return new SubscribableListener<>(new SuccessResult<>(result)); + } + + /** + * Create a {@link SubscribableListener} which has already failed with the given exception. + */ + public static SubscribableListener newFailed(Exception exception) { + return new SubscribableListener<>(new FailureResult(exception, exception)); + } + + /** + * Create a {@link SubscribableListener}, fork a computation to complete it, and return the listener. If the forking itself throws an + * exception then the exception is caught and fed to the returned listener. + */ + public static SubscribableListener newForked(CheckedConsumer, ? extends Exception> fork) { + final var listener = new SubscribableListener(); + ActionListener.run(listener, fork::accept); + return listener; + } + + private SubscribableListener(Object initialState) { + state = initialState; + } + /** * If we are incomplete, {@code state} may be one of the following depending on how many waiting subscribers there are: *