Skip to content

Commit 29b0491

Browse files
committed
Merge branch 'main' into rollup-support-cancel
* main: (163 commits) [DOCS] Edits frequent items aggregation (elastic#91564) Handle providers of optional services in ubermodule classloader (elastic#91217) Add `exportDockerImages` lifecycle task for exporting docker tarballs (elastic#91571) Fix CSV dependency report output file location in DRA CI job Fix variable placeholder for Strings.format calls (elastic#91531) Fix output dir creation in ConcatFileTask (elastic#91568) Fix declaration of dependencies in DRA snapshots CI job (elastic#91569) Upgrade Gradle Enterprise plugin to 3.11.4 (elastic#91435) Ingest DateProcessor (small) speedup, optimize collections code in DateFormatter.forPattern (elastic#91521) Fix inter project handling of generateDependenciesReport (elastic#91555) [Synthetics] Add synthetics-* read to fleet-server (elastic#91391) [ML] Copy more settings when creating DF analytics destination index (elastic#91546) Reduce CartesianCentroidIT flakiness (elastic#91553) Propagate last node to reinitialized routing tables (elastic#91549) Forecast write load during rollovers (elastic#91425) [DOCS] Warn about potential overhead of named queries (elastic#91512) Datastream unavailable exception metadata (elastic#91461) Generate docker images and dependency report in DRA ci job (elastic#91545) Support cartesian_bounds aggregation on point and shape (elastic#91298) Add support for EQL samples queries (elastic#91312) ... # Conflicts: # x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java
2 parents 558bf0a + d7c0b37 commit 29b0491

File tree

1,051 files changed

+35682
-9213
lines changed

Some content is hidden

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

1,051 files changed

+35682
-9213
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
jjbb-template: periodic-trigger-lgc.yml
3+
vars:
4+
- periodic-job: elastic+elasticsearch+%BRANCH%+periodic+dra-snapshot
5+
- lgc-job: elastic+elasticsearch+%BRANCH%+intake
6+
- cron: "H H/12 * * *"
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
- job:
3+
name: elastic+elasticsearch+%BRANCH%+periodic+dra-snapshot
4+
workspace: /dev/shm/elastic+elasticsearch+%BRANCH%+periodic+dra-snapshot
5+
display-name: "elastic / elasticsearch # %BRANCH% - DRA snapshot"
6+
description: "Publishing Daily Releasable Artifacts (DRAs) of Elasticsearch %BRANCH% snapshots.\n"
7+
node: "ubuntu-20.04"
8+
builders:
9+
- inject:
10+
properties-file: '.ci/java-versions.properties'
11+
properties-content: |
12+
JAVA_HOME=$HOME/.java/$ES_BUILD_JAVA
13+
RUNTIME_JAVA_HOME=$HOME/.java/$ES_RUNTIME_JAVA
14+
- shell: |
15+
#!/usr/local/bin/runbld --redirect-stderr
16+
ES_VERSION=$(cat build-tools-internal/version.properties \
17+
| grep elasticsearch \
18+
| sed "s/elasticsearch//g" \
19+
| sed "s/ //g" \
20+
| sed "s/=//")
21+
BEATS_BUILD_ID="$(./.ci/scripts/resolve-dra-manifest.sh beats master)"
22+
ML_CPP_BUILD_ID="$(./.ci/scripts/resolve-dra-manifest.sh ml-cpp master)"
23+
set -euo pipefail
24+
set +x
25+
VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id=$VAULT_ROLE_ID secret_id=$VAULT_SECRET_ID)
26+
export VAULT_TOKEN
27+
$WORKSPACE/.ci/scripts/run-gradle.sh -Ddra.artifacts=true \
28+
-Ddra.artifacts.dependency.beats=${BEATS_BUILD_ID} \
29+
-Ddra.artifacts.dependency.ml-cpp=${ML_CPP_BUILD_ID} \
30+
-Dcsv=$WORKSPACE/build/distributions/dependencies-${ES_VERSION}-SNAPSHOT.csv \
31+
buildReleaseArtifacts \
32+
exportDockerImages \
33+
:distribution:generateDependenciesReport
34+
35+
unset VAULT_TOKEN
36+
set -x
37+
$WORKSPACE/x-pack/plugin/sql/connectors/tableau/package.sh asm qualifier=-SNAPSHOT
38+
39+
# we regenerate this file as part of the release manager invocation
40+
rm $WORKSPACE/build/distributions/elasticsearch-jdbc-${ES_VERSION}-SNAPSHOT.taco.sha512
41+
42+
# Allow other users access to read the artifacts so they are readable in the
43+
# container
44+
find $WORKSPACE -type f -path "*/build/distributions/*" -exec chmod a+r {} \;
45+
46+
# Allow other users write access to create checksum files
47+
find $WORKSPACE -type d -path "*/build/distributions" -exec chmod a+w {} \;
48+
49+
# Artifacts should be generated
50+
docker run --rm \
51+
--name release-manager \
52+
-e VAULT_ADDR \
53+
-e VAULT_ROLE_ID \
54+
-e VAULT_SECRET_ID \
55+
--mount type=bind,readonly=false,src="$PWD",target=/artifacts \
56+
docker.elastic.co/infra/release-manager:latest \
57+
cli collect \
58+
--project elasticsearch \
59+
--branch "master" \
60+
--commit "$GIT_COMMIT" \
61+
--workflow "snapshot" \
62+
--version "$ES_VERSION" \
63+
--artifact-set main \
64+
--dependency beats:https://artifacts-snapshot.elastic.co/beats/${BEATS_BUILD_ID}/manifest-${ES_VERSION}-SNAPSHOT.json \
65+
--dependency ml-cpp:https://artifacts-snapshot.elastic.co/ml-cpp/${ML_CPP_BUILD_ID}/manifest-${ES_VERSION}-SNAPSHOT.json

.ci/scripts/resolve-dra-manifest.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -e
3+
ARTIFACT="${ARTIFACT:-$1}"
4+
BRANCH="${BRANCH:-$2}"
5+
6+
curl -sS https://artifacts-snapshot.elastic.co/$ARTIFACT/latest/$BRANCH.json \
7+
| jq -r '.build_id'

benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package org.elasticsearch.benchmark.routing.allocation;
99

1010
import org.elasticsearch.Version;
11+
import org.elasticsearch.action.ActionListener;
1112
import org.elasticsearch.cluster.ClusterName;
1213
import org.elasticsearch.cluster.ClusterState;
1314
import org.elasticsearch.cluster.metadata.IndexMetadata;
@@ -150,6 +151,9 @@ private int toInt(String v) {
150151
return Integer.valueOf(v.trim());
151152
}
152153

154+
/**
155+
* Once we use DesiredBalanceShardsAllocator this only measures reconciliation, not the balance calculation
156+
*/
153157
@Benchmark
154158
public ClusterState measureAllocation() {
155159
ClusterState clusterState = initialClusterState;
@@ -162,7 +166,7 @@ public ClusterState measureAllocation() {
162166
.filter(ShardRouting::initializing)
163167
.collect(Collectors.toList())
164168
);
165-
clusterState = strategy.reroute(clusterState, "reroute");
169+
clusterState = strategy.reroute(clusterState, "reroute", ActionListener.noop());
166170
}
167171
return clusterState;
168172
}

benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/Allocators.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.cluster.node.DiscoveryNode;
1414
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
1515
import org.elasticsearch.cluster.routing.ShardRouting;
16+
import org.elasticsearch.cluster.routing.allocation.AllocateUnassignedDecision;
1617
import org.elasticsearch.cluster.routing.allocation.AllocationService;
1718
import org.elasticsearch.cluster.routing.allocation.FailedShard;
1819
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
@@ -32,6 +33,8 @@
3233
import java.util.Map;
3334
import java.util.concurrent.atomic.AtomicInteger;
3435

36+
import static org.elasticsearch.cluster.routing.allocation.AllocateUnassignedDecision.NOT_TAKEN;
37+
3538
public final class Allocators {
3639
private static class NoopGatewayAllocator extends GatewayAllocator {
3740
public static final NoopGatewayAllocator INSTANCE = new NoopGatewayAllocator();
@@ -54,6 +57,14 @@ public void allocateUnassigned(
5457
) {
5558
// noop
5659
}
60+
61+
@Override
62+
public AllocateUnassignedDecision explainUnassignedShardAllocation(
63+
ShardRouting unassignedShard,
64+
RoutingAllocation routingAllocation
65+
) {
66+
return NOT_TAKEN;
67+
}
5768
}
5869

5970
private Allocators() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
package org.elasticsearch.benchmark.routing.allocation;
10+
11+
import org.elasticsearch.Version;
12+
import org.elasticsearch.cluster.ClusterName;
13+
import org.elasticsearch.cluster.ClusterState;
14+
import org.elasticsearch.cluster.metadata.IndexMetadata;
15+
import org.elasticsearch.cluster.metadata.Metadata;
16+
import org.elasticsearch.cluster.node.DiscoveryNodes;
17+
import org.elasticsearch.cluster.routing.IndexRoutingTable;
18+
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
19+
import org.elasticsearch.cluster.routing.RecoverySource;
20+
import org.elasticsearch.cluster.routing.RoutingTable;
21+
import org.elasticsearch.cluster.routing.ShardRouting;
22+
import org.elasticsearch.cluster.routing.UnassignedInfo;
23+
import org.elasticsearch.cluster.routing.allocation.AllocationService;
24+
import org.elasticsearch.cluster.routing.allocation.DataTier;
25+
import org.elasticsearch.cluster.routing.allocation.ShardsAvailabilityHealthIndicatorService;
26+
import org.elasticsearch.cluster.service.ClusterService;
27+
import org.elasticsearch.common.settings.ClusterSettings;
28+
import org.elasticsearch.common.settings.Settings;
29+
import org.elasticsearch.health.HealthIndicatorResult;
30+
import org.elasticsearch.health.node.HealthInfo;
31+
import org.elasticsearch.index.shard.ShardId;
32+
import org.elasticsearch.tasks.TaskManager;
33+
import org.elasticsearch.threadpool.ThreadPool;
34+
import org.openjdk.jmh.annotations.Benchmark;
35+
import org.openjdk.jmh.annotations.BenchmarkMode;
36+
import org.openjdk.jmh.annotations.Fork;
37+
import org.openjdk.jmh.annotations.Measurement;
38+
import org.openjdk.jmh.annotations.Mode;
39+
import org.openjdk.jmh.annotations.OutputTimeUnit;
40+
import org.openjdk.jmh.annotations.Param;
41+
import org.openjdk.jmh.annotations.Scope;
42+
import org.openjdk.jmh.annotations.Setup;
43+
import org.openjdk.jmh.annotations.State;
44+
import org.openjdk.jmh.annotations.Warmup;
45+
46+
import java.util.Collections;
47+
import java.util.HashSet;
48+
import java.util.Map;
49+
import java.util.Set;
50+
import java.util.concurrent.TimeUnit;
51+
52+
import static org.elasticsearch.cluster.metadata.IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING;
53+
54+
@Fork(3)
55+
@Warmup(iterations = 10)
56+
@Measurement(iterations = 10)
57+
@BenchmarkMode(Mode.AverageTime)
58+
@OutputTimeUnit(TimeUnit.MILLISECONDS)
59+
@State(Scope.Benchmark)
60+
@SuppressWarnings("unused") // invoked by benchmarking framework
61+
public class ShardsAvailabilityHealthIndicatorBenchmark {
62+
63+
@Param(
64+
{
65+
// indices| shards| replicas| nodes
66+
" 10000| 1| 0| 3",
67+
" 20000| 1| 0| 3",
68+
" 50000| 1| 0| 3",
69+
" 100000| 1| 0| 3",
70+
" 200000| 1| 0| 3",
71+
72+
" 10000| 1| 1| 3",
73+
" 20000| 1| 1| 3",
74+
" 50000| 1| 1| 3",
75+
" 100000| 1| 1| 3",
76+
" 200000| 1| 1| 3" }
77+
)
78+
public String indicesShardsReplicasNodes = "10|1|0|1";
79+
80+
private ShardsAvailabilityHealthIndicatorService indicatorService;
81+
82+
@Setup
83+
public void setUp() throws Exception {
84+
final String[] params = indicesShardsReplicasNodes.split("\\|");
85+
86+
int numIndices = toInt(params[0]);
87+
int numShards = toInt(params[1]);
88+
int numReplicas = toInt(params[2]);
89+
int numNodes = toInt(params[3]);
90+
91+
AllocationService allocationService = Allocators.createAllocationService(Settings.EMPTY);
92+
93+
Metadata.Builder mb = Metadata.builder();
94+
RoutingTable.Builder rb = RoutingTable.builder();
95+
96+
DiscoveryNodes.Builder nb = DiscoveryNodes.builder();
97+
Set<String> failedNodeIds = new HashSet<>();
98+
for (int i = 1; i <= numNodes; i++) {
99+
String nodeId = "node" + i;
100+
nb.add(Allocators.newNode(nodeId, Map.of()));
101+
failedNodeIds.add(nodeId);
102+
}
103+
104+
UnassignedInfo decidersNoUnassignedInfo = new UnassignedInfo(
105+
UnassignedInfo.Reason.ALLOCATION_FAILED,
106+
null,
107+
null,
108+
failedNodeIds.size(),
109+
System.nanoTime(),
110+
System.currentTimeMillis(),
111+
false,
112+
UnassignedInfo.AllocationStatus.DECIDERS_NO,
113+
failedNodeIds,
114+
null
115+
);
116+
117+
RoutingTable.Builder routingTable = RoutingTable.builder();
118+
for (int i = 1; i <= numIndices; i++) {
119+
IndexMetadata indexMetadata = IndexMetadata.builder("test_" + i)
120+
.settings(
121+
Settings.builder()
122+
.put("index.version.created", Version.CURRENT)
123+
.put(DataTier.TIER_PREFERENCE_SETTING.getKey(), "data_warm")
124+
.put(INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "data", "warm")
125+
)
126+
.numberOfShards(numShards)
127+
.numberOfReplicas(numReplicas)
128+
.build();
129+
130+
final IndexRoutingTable.Builder indexRountingTableBuilder = new IndexRoutingTable.Builder(indexMetadata.getIndex());
131+
for (int shardIdNumber = 0; shardIdNumber < numShards; shardIdNumber++) {
132+
ShardId shardId = new ShardId(indexMetadata.getIndex(), shardIdNumber);
133+
final IndexShardRoutingTable.Builder shardBuilder = new IndexShardRoutingTable.Builder(shardId);
134+
ShardRouting shardRouting = ShardRouting.newUnassigned(
135+
shardId,
136+
true,
137+
RecoverySource.ExistingStoreRecoverySource.INSTANCE,
138+
decidersNoUnassignedInfo
139+
);
140+
shardBuilder.addShard(shardRouting);
141+
if (shardIdNumber < numReplicas) {
142+
shardBuilder.addShard(
143+
ShardRouting.newUnassigned(
144+
shardId,
145+
false,
146+
RecoverySource.EmptyStoreRecoverySource.INSTANCE,
147+
decidersNoUnassignedInfo
148+
)
149+
);
150+
}
151+
indexRountingTableBuilder.addIndexShard(shardBuilder);
152+
}
153+
154+
routingTable.add(indexRountingTableBuilder);
155+
mb.put(indexMetadata, false);
156+
}
157+
158+
ClusterState initialClusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY))
159+
.metadata(mb)
160+
.routingTable(routingTable)
161+
.nodes(nb)
162+
.build();
163+
164+
Settings settings = Settings.builder().put("node.name", ShardsAvailabilityHealthIndicatorBenchmark.class.getSimpleName()).build();
165+
ThreadPool threadPool = new ThreadPool(settings);
166+
167+
ClusterService clusterService = new ClusterService(
168+
Settings.EMPTY,
169+
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS),
170+
threadPool,
171+
new TaskManager(Settings.EMPTY, threadPool, Collections.emptySet())
172+
);
173+
clusterService.getClusterApplierService().setInitialState(initialClusterState);
174+
indicatorService = new ShardsAvailabilityHealthIndicatorService(clusterService, allocationService);
175+
}
176+
177+
private int toInt(String v) {
178+
return Integer.parseInt(v.trim());
179+
}
180+
181+
@Benchmark
182+
public HealthIndicatorResult measureCalculate() {
183+
return indicatorService.calculate(true, HealthInfo.EMPTY_HEALTH_INFO);
184+
}
185+
186+
}

build-tools-internal/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ gradlePlugin {
5151
id = 'elasticsearch.docs-test'
5252
implementationClass = 'org.elasticsearch.gradle.internal.doc.DocsTestPlugin'
5353
}
54+
draArtifacts {
55+
id = 'elasticsearch.dra-artifacts'
56+
implementationClass = 'org.elasticsearch.gradle.internal.dra.DraResolvePlugin'
57+
}
5458
globalBuildInfo {
5559
id = 'elasticsearch.global-build-info'
5660
implementationClass = 'org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin'

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/fixtures/LocalRepositoryFixture.groovy

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class LocalRepositoryFixture extends ExternalResource {
1717

1818
private TemporaryFolder temporaryFolder
1919

20-
LocalRepositoryFixture(){
20+
LocalRepositoryFixture() {
2121
this.temporaryFolder = new TemporaryFolder()
2222
}
2323

@@ -33,22 +33,27 @@ class LocalRepositoryFixture extends ExternalResource {
3333
temporaryFolder.after()
3434
}
3535

36-
void generateJar(String group, String module, String version, String... clazzNames){
36+
void generateJar(String group, String module, String version, String... clazzNames) {
3737
def baseGroupFolderPath = group.replace('.', '/')
3838
def targetFolder = new File(repoDir, "${baseGroupFolderPath}/$module/$version")
3939
targetFolder.mkdirs()
4040

4141
def jarFile = new File(targetFolder, "${module}-${version}.jar")
42-
clazzNames.each {clazzName ->
43-
DynamicType.Unloaded<?> dynamicType = new ByteBuddy().subclass(Object.class)
44-
.name(clazzName)
45-
.make()
46-
if(jarFile.exists()) {
47-
dynamicType.inject(jarFile);
48-
}else {
49-
dynamicType.toJar(jarFile);
42+
if (clazzNames.size() == 0) {
43+
jarFile.write("blubb")
44+
} else {
45+
clazzNames.each { clazzName ->
46+
DynamicType.Unloaded<?> dynamicType = new ByteBuddy().subclass(Object.class)
47+
.name(clazzName)
48+
.make()
49+
if (jarFile.exists()) {
50+
dynamicType.inject(jarFile);
51+
} else {
52+
dynamicType.toJar(jarFile);
53+
}
5054
}
5155
}
56+
5257
}
5358

5459
void configureBuild(File buildFile) {

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/BuildPluginFuncTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class BuildPluginFuncTest extends AbstractGradleFuncTest {
5252
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.""".stripIndent()
5353

5454
def setup() {
55+
configurationCacheCompatible = false
5556
buildFile << """
5657
plugins {
5758
id 'java'

0 commit comments

Comments
 (0)