Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
cb97b5d
not working, but some fixed
pgomulka Jun 17, 2020
63f524c
Merge branch 'compat/delete_update' into compat/mapping
pgomulka Jun 18, 2020
c645bfb
157 passing of 1308 tests.
pgomulka Jun 23, 2020
ff3b016
Merge branch 'compat/search' into compat/mapping
pgomulka Jul 7, 2020
4a6e796
spotless
pgomulka Jul 7, 2020
85d837f
implementation
pgomulka Jul 7, 2020
4d8cb1f
Merge branch 'compat/delete_update' into compat/mapping
pgomulka Jul 7, 2020
9f382e2
Merge branch 'compat/delete_update' into compat/mapping
pgomulka Jul 7, 2020
bab4d96
Merge branch 'compat/delete_update' into compat/mapping
pgomulka Jul 7, 2020
d08f0f9
checkstyle
pgomulka Jul 7, 2020
e302959
Merge branch 'compat/delete_update' into compat/mapping
pgomulka Jul 8, 2020
eb0b358
test overrides
pgomulka Jul 8, 2020
0db1e03
Merge branch 'compat/delete_update' into compat/mapping
pgomulka Jul 8, 2020
b9deb66
Include the ml inference aggregation doc (#59219)
davidkyle Jul 8, 2020
3d40b35
Verify distro archives do not contain plain class files (#59073)
breskeby Jul 8, 2020
678f9e3
Revert "[DOCS] Update get data stream API response (#59197)" (#59227)
jrodewig Jul 8, 2020
04e1177
Clean searchable snapshots cache on startup (#59009)
DaveCTurner Jul 8, 2020
bb002cf
Add allowed warning in composable template upgrade test (#59180)
dakrone Jul 8, 2020
7bd93de
[DOCS] Update get data stream API response (#59197) (#59230)
jrodewig Jul 8, 2020
bb50b62
fix get mappings
pgomulka Jul 8, 2020
b2beb9c
[DOCS] Adding get snapshot API docs (#59098)
Jul 8, 2020
52bfe9e
[DOCS] EQL: Document `size` limit for pipes (#59085)
jrodewig Jul 8, 2020
512649c
[DOCS] Add data streams to security docs (#59084)
jrodewig Jul 8, 2020
865b6b5
Fix testSendSnapshotSendsOps
dnhatn Jul 8, 2020
dbea483
Fix SLMSnapshotBlockingIntegTests.testSnapshotInProgress (#59218)
original-brownbear Jul 8, 2020
51438c3
Renable bwc tests after #59076 has been backported (#59234)
martijnvg Jul 8, 2020
611fb03
Implement rejections in `WriteMemoryLimits` (#58885)
Tim-Brooks Jul 8, 2020
5688e0e
Do not release safe commit with CancellableThreads (#59182)
dnhatn Jul 8, 2020
30be215
[DOCS] Document `@timestamp` as only valid DS timestamp field (#59225)
jrodewig Jul 8, 2020
28ca127
Improve vwh's distant bucket handling (#59094)
nik9000 Jul 8, 2020
49f9431
Add Inference Pipeline aggregation to HLRC (#59086)
davidkyle Jul 8, 2020
54e0c95
Remove random of recovery chunk size setting
dnhatn Jul 8, 2020
09867ec
Parameterize windows packaging test script (#58980)
mark-vieira Jul 8, 2020
a251bf3
Fix numerical error in CentroidCalculatorTests#testPolygonAsPoint (#5…
iverase Jul 9, 2020
8b29817
Add sample versions of standard deviation and variance functions (#59…
bpintea Jul 9, 2020
486d9a5
Add Support in geo_match enrichment policy for any type of geometry (…
iverase Jul 9, 2020
c531ecc
Mute testFollowIndexWithConcurrentMappingChanges (#59275)
danielmitterdorfer Jul 9, 2020
7f5daaa
Only conditionally add searchable_snapshots action based on build type
ywelsch Jul 9, 2020
6ede6c5
Remove search_after and implicit_join_key_field (#59232)
astefan Jul 9, 2020
dc3713d
[ML] Add REST spec for the update data frame analytics endpoint (#59253)
dimitris-athanasiou Jul 9, 2020
83cf22a
Improve auditing of API key authentication (#58928)
albertzaharovits Jul 9, 2020
219b7db
Add declarative parameters to FieldMappers (#58663)
romseygeek Jul 9, 2020
3504558
[ML] Fix doc link for update DFA spec (#59282)
dimitris-athanasiou Jul 9, 2020
ed80a00
Skip unnecessary directory iteration (#59007)
DaveCTurner Jul 9, 2020
a788650
Mute testMaxRestoreBytesPerSecIsUsed (#59288)
danielmitterdorfer Jul 9, 2020
5e73d71
Fix node health-check-related test failures (#59277)
DaveCTurner Jul 9, 2020
91c21b1
[ML] Perform test inference on java (#58877)
benwtrent Jul 9, 2020
c8ffe3c
EQL: Give a name to all toml tests and enforce the naming of new test…
astefan Jul 9, 2020
b174655
[DOCS] Add x-pack tag to data stream docs (#59241)
jrodewig Jul 9, 2020
1ba1b9f
EQL: Introduce until functionality (#59292)
costin Jul 9, 2020
650f20e
Default gateway.auto_import_dangling_indices to false (#58898)
pugnascotia Jul 9, 2020
da0249f
[ML] Data frame analytics max_num_threads setting (#59254)
dimitris-athanasiou Jul 9, 2020
cff94a5
Restart tests with data streams (#58330)
probakowski Jul 9, 2020
381f8d3
[DOCS] Clarify subscription requirements (#58958)
lcawl Jul 9, 2020
97bc6a9
[ML] Mute data frame analytics BWC tests (#59306)
dimitris-athanasiou Jul 9, 2020
2c879eb
Fix broken links to aggregation javadoc (#59083)
davidkyle Jul 9, 2020
2f60ff4
Scripting: Remove general cache settings (#59262)
stu-elastic Jul 9, 2020
8d8bd3d
Scripting: Move script_cache into _nodes/stats (#59265)
stu-elastic Jul 9, 2020
947df32
Fix NPE when building exception messages for aggregations (#59156)
not-napoleon Jul 9, 2020
62f51eb
MappedFieldType no longer requires equals/hashCode/clone (#59212)
romseygeek Jul 9, 2020
4718953
[DOCS] Document index aliases do not support data streams (#59321)
jrodewig Jul 9, 2020
cef242d
[DOCS] Document custom routing support for data streams (#59323)
jrodewig Jul 9, 2020
5e832f3
[DOCS] Add data streams to clear cache API docs (#59324)
jrodewig Jul 9, 2020
aa6cb87
[DOCS] Add data streams to field caps API docs (#59326)
jrodewig Jul 9, 2020
83e78ac
Scripting: Re-enable bwc from #59265 (#59336)
stu-elastic Jul 9, 2020
a8aecb8
Scripting: Unlimited compilation rate for ingest (#59267)
stu-elastic Jul 9, 2020
aacf624
[ML] Adjust versions and unmute BWC tests after backport of #59254 (#…
dimitris-athanasiou Jul 9, 2020
d333dac
Enable Fully Concurrent Snapshot Operations (#56911)
original-brownbear Jul 10, 2020
c0c8bb5
Fix deprecated unsave project outputs resolution (#59088)
breskeby Jul 10, 2020
b961454
Data stream support for rollup search (#59296)
danhermann Jul 10, 2020
f571ea7
Remove Outdated Documentation On Snapshots (#59358)
original-brownbear Jul 10, 2020
198b425
Data stream admin actions are now index-level actions (#59095)
danhermann Jul 10, 2020
9954bf1
[DOCS] Update get data stream API
danhermann Jul 10, 2020
833f0fb
Update index privileges doc to include data streams (#59139)
danhermann Jul 10, 2020
1eba8e9
Reenable BWC tests
danhermann Jul 10, 2020
4c1b081
Fix estimate size of translog operations (#59206)
dnhatn Jul 13, 2020
ef8b414
Mute FsHealthServiceTests testFailsHealthOnIOException (#59382)
davidkyle Jul 13, 2020
f8002a7
[DOCS] Fixes getting time features example in Painless in Transforms …
szabosteve Jul 13, 2020
3586183
Mute SnapshotResiliencyTests (#59385)
davidkyle Jul 13, 2020
2b1f503
put overrides
pgomulka Jul 13, 2020
40b9fd4
Make data streams a basic licensed feature. (#59293)
martijnvg Jul 13, 2020
3363048
Continue to accept unused 'universal' params in <8.0 indexes (#59381)
romseygeek Jul 13, 2020
202314b
[ML] Drive categorization warning notifications from annotations (#59…
droberts195 Jul 13, 2020
c831f37
Enhance real memory circuit breaker with G1 GC (#58674)
henningandersen Jul 13, 2020
3cb9105
[Docs] Fix typo in IndicesService (#59202)
howardhuanghua Jul 13, 2020
e63f2f8
Fix FSHealthServiceTests on Windows (#59387)
DaveCTurner Jul 13, 2020
a4e7ed0
Update ICU Analyzer Documentation (#59305)
dylanmann Jul 13, 2020
5273681
Update indexing-speed.asciidoc (#59347)
pure-zero Jul 13, 2020
a28ce1e
Improve role cache efficiency for API key roles (#58156)
ywangd Jul 13, 2020
24786ac
Migrate CompletionFieldMapper to parametrized format (#59291)
romseygeek Jul 13, 2020
bb618c8
[ML] Remove unused member var from ExtractedFieldsDetector (#59395)
dimitris-athanasiou Jul 13, 2020
82740f6
[DOCS] Add ingest pipeline ex to data stream docs (#58343)
jrodewig Jul 13, 2020
786104e
[DOCS] Update snapshot/restore and SLM docs for data streams (#58513)
jrodewig Jul 13, 2020
284ee85
[DOCS] Add data streams to EQL search docs (#58611)
jrodewig Jul 13, 2020
747e615
[DOCS] EQL: Prepare docs for release (#59259)
jrodewig Jul 13, 2020
25c6a12
[DOCS] EQL: Document `until` keyword support (#59320)
jrodewig Jul 13, 2020
9071c82
[DOCS] Add data streams to searchable snapshot API docs (#59325)
jrodewig Jul 13, 2020
cd75614
[DOCS] Add data streams to index APIs (#59329)
jrodewig Jul 13, 2020
55b6c1a
[DOCS] Add data streams to ILM explain API (#59343)
jrodewig Jul 13, 2020
3202f46
Add ml licence check to the pipeline inference agg. (#59213)
davidkyle Jul 13, 2020
20874dc
EQL: Prepare for release (#59331)
imotov Jul 13, 2020
c2d58c8
Mute RegressionIT failure (#59414)
davidkyle Jul 13, 2020
38aa0c1
[DOCS] MatchQuery: `transpositions` to `fuzzy_transpositions` (#59371)
homersimpsons Jul 13, 2020
2976ba4
Histogram integration on Histogram field type (#58930)
csoulios Jul 13, 2020
43650f0
[ML] Fix result processor test for random annotation (#59421)
droberts195 Jul 13, 2020
7def22c
Add auto_configure privilege (#59243)
danhermann Jul 13, 2020
b61aa9d
Fix Snapshot not Starting in Partial Snapshot Corner Case (#59428)
original-brownbear Jul 13, 2020
0bc9055
Re-able bwc tests (#59432)
martijnvg Jul 13, 2020
836e4f9
Accounting for model size when models are not cached. (#58670)
davidkyle Jul 13, 2020
69899dc
[DOCS] Add data streams to validate query API (#59420)
jrodewig Jul 13, 2020
ddd882b
Convert modules to use yamlRestTest (#59089)
jakelandis Jul 13, 2020
31702b7
[DOCS] Add data streams to reload search analyzers API (#59422)
jrodewig Jul 13, 2020
b87bb86
Adding indexing pressure stats to node stats API (#59247)
Tim-Brooks Jul 13, 2020
d543c27
Add telemetery for data streams (#59433)
dakrone Jul 13, 2020
dc91a30
Move getPointReaderOrNull into AggregatorBase (#58769)
not-napoleon Jul 13, 2020
dea030f
Mute ModelLoadingServiceTests
davidkyle Jul 13, 2020
45da8df
Fix license header for DataStreamRestIT
dakrone Jul 13, 2020
ac8715a
[ML] fixing inference reference counting tests (#59453)
benwtrent Jul 13, 2020
3a5013e
[DOCS] Clarify that passwords are not preserved for `kibana_system` u…
jrodewig Jul 13, 2020
e84a501
Add microbenchmark for LongKeyedBucketOrds (#58608)
nik9000 Jul 13, 2020
4dc5c87
Indicating that the size parameter defaults to 10. (#59438)
Jul 13, 2020
f292edb
[DOCS] Add data streams to rollup APIs (#59423)
jrodewig Jul 13, 2020
e6e906d
Update skip after backport of #42035
nik9000 Jul 13, 2020
0af410a
Adds hard_bounds to histogram aggregations (#59175)
imotov Jul 13, 2020
86d8312
Mute BWC tests for indexing pressure backport (#59468)
Tim-Brooks Jul 13, 2020
12c61e0
Change 7.9.99 -> 7.99.99 in tests (#59469)
imotov Jul 13, 2020
307aaa5
Mute DoubleBounds testXContentRoundTrip test (#59477)
imotov Jul 13, 2020
1d7085d
Ensure fixture runtime dependencies are built before starting contain…
mark-vieira Jul 13, 2020
5d7271a
Update node.asciidoc (#59201) (#59480)
debadair Jul 13, 2020
9f22634
Update versions for indexing pressure backport (#59472)
Tim-Brooks Jul 14, 2020
a51dda8
Assign follower primary to nodes with remote cluster client role (#59…
dnhatn Jul 14, 2020
c0fc9d0
Allow null name when deserialising API key document (#59485)
ywangd Jul 14, 2020
2df6157
Compatible logic for Removes typed endpoint from search and related A…
pgomulka Jul 14, 2020
8d457a2
Remove remaining deprecated api usages (#59231)
breskeby Jul 14, 2020
9e522ee
Merge branch 'master' into compat_rest_api
pgomulka Jul 14, 2020
cacef33
Validate compatible handlers have correct version (#58304)
pgomulka Jul 14, 2020
e457a92
Compatible Delete and Update rest actions (#58246)
pgomulka Jul 14, 2020
699bfac
Merge branch 'compat_rest_api' into compat/mapping
pgomulka Jul 14, 2020
2fa8953
spotless
pgomulka Jul 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .ci/os.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
param($GradleTasks='destructiveDistroTest')

If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Relaunch as an elevated process:
Expand Down Expand Up @@ -25,7 +27,6 @@ Remove-Item -Recurse -Force \tmp -ErrorAction Ignore
New-Item -ItemType directory -Path \tmp

$ErrorActionPreference="Continue"
# TODO: remove the task exclusions once dependencies are set correctly and these don't run for Windows or buldiung the deb on windows is fixed
& .\gradlew.bat -g "C:\Users\$env:username\.gradle" --parallel --no-daemon --scan --console=plain destructiveDistroTest
& .\gradlew.bat -g "C:\Users\$env:username\.gradle" --parallel --no-daemon --scan --console=plain $GradleTasks

exit $LastExitCode
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.elasticsearch.benchmark.search.aggregations.bucket.terms;

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.PageCacheRecycler;
import org.elasticsearch.search.aggregations.CardinalityUpperBound;
import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.terms.LongKeyedBucketOrds;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OperationsPerInvocation;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;

import java.util.concurrent.TimeUnit;

@Fork(2)
@Warmup(iterations = 10)
@Measurement(iterations = 5)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@OperationsPerInvocation(1_000_000)
@State(Scope.Benchmark)
public class LongKeyedBucketOrdsBenchmark {
private static final long LIMIT = 1_000_000;
/**
* The number of distinct values to add to the buckets.
*/
private static final long DISTINCT_VALUES = 10;
/**
* The number of buckets to create in the {@link #multiBucket} case.
* <p>
* If this is not relatively prime to {@link #DISTINCT_VALUES} then the
* values won't be scattered evenly across the buckets.
*/
private static final long DISTINCT_BUCKETS = 21;

private final PageCacheRecycler recycler = new PageCacheRecycler(Settings.EMPTY);
private final BigArrays bigArrays = new BigArrays(recycler, null, "REQUEST");

/**
* Force loading all of the implementations just for extra paranoia's sake.
* We really don't want the JVM to be able to eliminate one of them just
* because we don't use it in the particular benchmark. That is totally a
* thing it'd do. It is sneaky.
*/
@Setup
public void forceLoadClasses(Blackhole bh) {
bh.consume(LongKeyedBucketOrds.FromSingle.class);
bh.consume(LongKeyedBucketOrds.FromMany.class);
}

/**
* Emulates a way that we do <strong>not</strong> use {@link LongKeyedBucketOrds}
* because it is not needed.
*/
@Benchmark
public void singleBucketIntoSingleImmutableMonmorphicInvocation(Blackhole bh) {
try (LongKeyedBucketOrds.FromSingle ords = new LongKeyedBucketOrds.FromSingle(bigArrays)) {
for (long i = 0; i < LIMIT; i++) {
ords.add(0, i % DISTINCT_VALUES);
}
bh.consume(ords);
}
}

/**
* Emulates the way that most aggregations use {@link LongKeyedBucketOrds}.
*/
@Benchmark
public void singleBucketIntoSingleImmutableBimorphicInvocation(Blackhole bh) {
try (LongKeyedBucketOrds ords = LongKeyedBucketOrds.build(bigArrays, CardinalityUpperBound.ONE)) {
for (long i = 0; i < LIMIT; i++) {
ords.add(0, i % DISTINCT_VALUES);
}
bh.consume(ords);
}
}

/**
* Emulates the way that {@link AutoDateHistogramAggregationBuilder} uses {@link LongKeyedBucketOrds}.
*/
@Benchmark
public void singleBucketIntoSingleMutableMonmorphicInvocation(Blackhole bh) {
LongKeyedBucketOrds.FromSingle ords = new LongKeyedBucketOrds.FromSingle(bigArrays);
for (long i = 0; i < LIMIT; i++) {
if (i % 100_000 == 0) {
ords.close();
bh.consume(ords);
ords = new LongKeyedBucketOrds.FromSingle(bigArrays);
}
ords.add(0, i % DISTINCT_VALUES);
}
bh.consume(ords);
ords.close();
}

/**
* Emulates a way that we do <strong>not</strong> use {@link LongKeyedBucketOrds}
* because it is significantly slower than the
* {@link #singleBucketIntoSingleMutableMonmorphicInvocation monomorphic invocation}.
*/
@Benchmark
public void singleBucketIntoSingleMutableBimorphicInvocation(Blackhole bh) {
LongKeyedBucketOrds ords = LongKeyedBucketOrds.build(bigArrays, CardinalityUpperBound.ONE);
for (long i = 0; i < LIMIT; i++) {
if (i % 100_000 == 0) {
ords.close();
bh.consume(ords);
ords = LongKeyedBucketOrds.build(bigArrays, CardinalityUpperBound.ONE);
}
ords.add(0, i % DISTINCT_VALUES);

}
bh.consume(ords);
ords.close();
}

/**
* Emulates an aggregation that collects from a single bucket "by accident".
* This can happen if an aggregation is under, say, a {@code terms}
* aggregation and there is only a single value for that term in the index.
*/
@Benchmark
public void singleBucketIntoMulti(Blackhole bh) {
try (LongKeyedBucketOrds ords = LongKeyedBucketOrds.build(bigArrays, CardinalityUpperBound.MANY)) {
for (long i = 0; i < LIMIT; i++) {
ords.add(0, i % DISTINCT_VALUES);
}
bh.consume(ords);
}
}

/**
* Emulates an aggregation that collects from many buckets.
*/
@Benchmark
public void multiBucket(Blackhole bh) {
try (LongKeyedBucketOrds ords = LongKeyedBucketOrds.build(bigArrays, CardinalityUpperBound.MANY)) {
for (long i = 0; i < LIMIT; i++) {
ords.add(i % DISTINCT_BUCKETS, i % DISTINCT_VALUES);
}
bh.consume(ords);
}
}
}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ tasks.register("verifyVersions") {
* after the backport of the backcompat code is complete.
*/

boolean bwc_tests_enabled = false
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/59076" /* place a PR link here when committing bwc changes */
boolean bwc_tests_enabled = true
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
if (bwc_tests_enabled == false) {
if (bwc_tests_disabled_issue.isEmpty()) {
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import groovy.transform.CompileStatic
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.ElasticsearchJavaPlugin
import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask
import org.elasticsearch.gradle.RepositoriesSetupPlugin
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
import org.elasticsearch.gradle.precommit.PrecommitTasks
Expand Down Expand Up @@ -59,9 +60,9 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
project.rootProject.pluginManager.apply(GlobalBuildInfoPlugin)
project.pluginManager.apply(JavaBasePlugin)
project.pluginManager.apply(TestClustersPlugin)
project.pluginManager.apply(RepositoriesSetupPlugin)

project.getTasks().create("buildResources", ExportElasticsearchBuildResourcesTask)
ElasticsearchJavaPlugin.configureRepositories(project)
ElasticsearchJavaPlugin.configureTestTasks(project)
ElasticsearchJavaPlugin.configureInputNormalization(project)
ElasticsearchJavaPlugin.configureCompile(project)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
import org.gradle.api.artifacts.ModuleDependency;
import org.gradle.api.artifacts.ProjectDependency;
import org.gradle.api.artifacts.ResolutionStrategy;
import org.gradle.api.artifacts.dsl.RepositoryHandler;
import org.gradle.api.artifacts.repositories.IvyArtifactRepository;
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
import org.gradle.api.execution.TaskActionListener;
import org.gradle.api.file.FileCollection;
import org.gradle.api.plugins.BasePlugin;
Expand All @@ -59,16 +56,10 @@

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure;
import static org.elasticsearch.gradle.util.Util.toStringable;
Expand All @@ -83,11 +74,11 @@ public void apply(Project project) {
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
// apply global test task failure listener
project.getRootProject().getPluginManager().apply(TestFailureReportingPlugin.class);

// common repositories setup
project.getPluginManager().apply(RepositoriesSetupPlugin.class);
project.getPluginManager().apply(JavaLibraryPlugin.class);

configureConfigurations(project);
configureRepositories(project);
configureCompile(project);
configureInputNormalization(project);
configureTestTasks(project);
Expand Down Expand Up @@ -149,77 +140,6 @@ public static void configureConfigurations(Project project) {
disableTransitiveDeps.accept(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME);
}

private static final Pattern LUCENE_SNAPSHOT_REGEX = Pattern.compile("\\w+-snapshot-([a-z0-9]+)");

/**
* Adds repositories used by ES dependencies
*/
public static void configureRepositories(Project project) {
// ensure all repositories use secure urls
// TODO: remove this with gradle 7.0, which no longer allows insecure urls
project.getRepositories().all(repository -> {
if (repository instanceof MavenArtifactRepository) {
final MavenArtifactRepository maven = (MavenArtifactRepository) repository;
assertRepositoryURIIsSecure(maven.getName(), project.getPath(), maven.getUrl());
for (URI uri : maven.getArtifactUrls()) {
assertRepositoryURIIsSecure(maven.getName(), project.getPath(), uri);
}
} else if (repository instanceof IvyArtifactRepository) {
final IvyArtifactRepository ivy = (IvyArtifactRepository) repository;
assertRepositoryURIIsSecure(ivy.getName(), project.getPath(), ivy.getUrl());
}
});
RepositoryHandler repos = project.getRepositories();
if (System.getProperty("repos.mavenLocal") != null) {
// with -Drepos.mavenLocal=true we can force checking the local .m2 repo which is
// useful for development ie. bwc tests where we install stuff in the local repository
// such that we don't have to pass hardcoded files to gradle
repos.mavenLocal();
}
repos.jcenter();

String luceneVersion = VersionProperties.getLucene();
if (luceneVersion.contains("-snapshot")) {
// extract the revision number from the version with a regex matcher
Matcher matcher = LUCENE_SNAPSHOT_REGEX.matcher(luceneVersion);
if (matcher.find() == false) {
throw new GradleException("Malformed lucene snapshot version: " + luceneVersion);
}
String revision = matcher.group(1);
MavenArtifactRepository luceneRepo = repos.maven(repo -> {
repo.setName("lucene-snapshots");
repo.setUrl("https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + revision);
});
repos.exclusiveContent(exclusiveRepo -> {
exclusiveRepo.filter(
descriptor -> descriptor.includeVersionByRegex("org\\.apache\\.lucene", ".*", ".*-snapshot-" + revision)
);
exclusiveRepo.forRepositories(luceneRepo);
});
}
}

private static final List<String> SECURE_URL_SCHEMES = Arrays.asList("file", "https", "s3");

private static void assertRepositoryURIIsSecure(final String repositoryName, final String projectPath, final URI uri) {
if (uri != null && SECURE_URL_SCHEMES.contains(uri.getScheme()) == false) {
String url;
try {
url = uri.toURL().toString();
} catch (MalformedURLException e) {
throw new IllegalStateException(e);
}
final String message = String.format(
Locale.ROOT,
"repository [%s] on project with path [%s] is not using a secure protocol for artifacts on [%s]",
repositoryName,
projectPath,
url
);
throw new GradleException(message);
}
}

/**
* Adds compiler settings to the project
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ private class PropertyListEntry<T> {
this.normalization = normalization;
}

@Input
public PropertyNormalization getNormalization() {
return normalization;
}
Expand Down
Loading