Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into bump_example_compil…
Browse files Browse the repository at this point in the history
…e_version
  • Loading branch information
jakelandis committed Sep 26, 2024
2 parents 6c093fa + 8881886 commit ce1708a
Show file tree
Hide file tree
Showing 1,085 changed files with 28,448 additions and 10,348 deletions.
12 changes: 8 additions & 4 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ if [[ "${USE_SNYK_CREDENTIALS:-}" == "true" ]]; then
fi

if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then
DOCKER_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/migrated/prod_docker_registry_credentials)"
export DOCKER_REGISTRY_USERNAME
if which docker > /dev/null 2>&1; then
DOCKER_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/migrated/prod_docker_registry_credentials)"
export DOCKER_REGISTRY_USERNAME

DOCKER_REGISTRY_PASSWORD="$(vault read -field=password secret/ci/elastic-elasticsearch/migrated/prod_docker_registry_credentials)"
export DOCKER_REGISTRY_PASSWORD
DOCKER_REGISTRY_PASSWORD="$(vault read -field=password secret/ci/elastic-elasticsearch/migrated/prod_docker_registry_credentials)"
export DOCKER_REGISTRY_PASSWORD

docker login --username "$DOCKER_REGISTRY_USERNAME" --password "$DOCKER_REGISTRY_PASSWORD" docker.elastic.co
fi
fi

if [[ "$BUILDKITE_AGENT_META_DATA_PROVIDER" != *"k8s"* ]]; then
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipelines/intake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ steps:
timeout_in_minutes: 300
matrix:
setup:
BWC_VERSION: ["8.15.2", "8.16.0", "9.0.0"]
BWC_VERSION: ["8.15.3", "8.16.0", "9.0.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down
6 changes: 3 additions & 3 deletions .buildkite/pipelines/periodic-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ steps:
env:
BWC_VERSION: 8.14.3

- label: "{{matrix.image}} / 8.15.2 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.15.2
- label: "{{matrix.image}} / 8.15.3 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.15.3
timeout_in_minutes: 300
matrix:
setup:
Expand All @@ -303,7 +303,7 @@ steps:
buildDirectory: /dev/shm/bk
diskSizeGb: 250
env:
BWC_VERSION: 8.15.2
BWC_VERSION: 8.15.3

- label: "{{matrix.image}} / 8.16.0 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.16.0
Expand Down
10 changes: 5 additions & 5 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ steps:
- signal_reason: agent_stop
limit: 3

- label: 8.15.2 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.15.2#bwcTest
- label: 8.15.3 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.15.3#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
Expand All @@ -313,7 +313,7 @@ steps:
preemptible: true
diskSizeGb: 250
env:
BWC_VERSION: 8.15.2
BWC_VERSION: 8.15.3
retry:
automatic:
- exit_status: "-1"
Expand Down Expand Up @@ -431,7 +431,7 @@ steps:
setup:
ES_RUNTIME_JAVA:
- openjdk17
BWC_VERSION: ["8.15.2", "8.16.0", "9.0.0"]
BWC_VERSION: ["8.15.3", "8.16.0", "9.0.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down Expand Up @@ -475,7 +475,7 @@ steps:
ES_RUNTIME_JAVA:
- openjdk21
- openjdk23
BWC_VERSION: ["8.15.2", "8.16.0", "9.0.0"]
BWC_VERSION: ["8.15.3", "8.16.0", "9.0.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down
2 changes: 1 addition & 1 deletion .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ BWC_VERSION:
- "8.12.2"
- "8.13.4"
- "8.14.3"
- "8.15.2"
- "8.15.3"
- "8.16.0"
- "9.0.0"
3 changes: 2 additions & 1 deletion .ci/scripts/packaging-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if [ -f "/etc/os-release" ] ; then
# Work around incorrect lintian version
# https://github.com/elastic/elasticsearch/issues/48573
if [ $VERSION_ID == 10 ] ; then
sudo apt-get update -y
sudo apt-get update -y || true
sudo apt-get install -y --allow-downgrades lintian=2.15.0
fi
fi
Expand Down Expand Up @@ -77,5 +77,6 @@ sudo -E env \
--unset=ES_JAVA_HOME \
--unset=JAVA_HOME \
SYSTEM_JAVA_HOME=`readlink -f -n $BUILD_JAVA_HOME` \
DOCKER_CONFIG="${HOME}/.docker" \
./gradlew -g $HOME/.gradle --scan --parallel --build-cache -Dorg.elasticsearch.build.cache.url=https://gradle-enterprise.elastic.co/cache/ --continue $@

2 changes: 1 addition & 1 deletion .ci/snapshotBwcVersions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BWC_VERSION:
- "8.15.2"
- "8.15.3"
- "8.16.0"
- "9.0.0"
4 changes: 0 additions & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,3 @@ server/src/main/java/org/elasticsearch/threadpool @elastic/es-core-infra
# Security
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege @elastic/es-security
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStore.java @elastic/es-security

# Analytical engine
x-pack/plugin/esql @elastic/es-analytical-engine
x-pack/plugin/esql-core @elastic/es-analytical-engine
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
import org.elasticsearch.compute.operator.EvalOperator;
import org.elasticsearch.compute.operator.Operator;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
import org.elasticsearch.xpack.esql.core.expression.Literal;
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePattern;
import org.elasticsearch.xpack.esql.core.tree.Source;
import org.elasticsearch.xpack.esql.core.type.DataType;
import org.elasticsearch.xpack.esql.core.type.EsField;
import org.elasticsearch.xpack.esql.evaluator.EvalMapper;
import org.elasticsearch.xpack.esql.expression.function.scalar.conditional.Case;
import org.elasticsearch.xpack.esql.expression.function.scalar.date.DateTrunc;
import org.elasticsearch.xpack.esql.expression.function.scalar.math.Abs;
import org.elasticsearch.xpack.esql.expression.function.scalar.multivalue.MvMin;
Expand All @@ -53,6 +55,7 @@

import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -91,6 +94,8 @@ public class EvalBenchmark {
"abs",
"add",
"add_double",
"case_1_eager",
"case_1_lazy",
"date_trunc",
"equal_to_const",
"long_equal_to_long",
Expand Down Expand Up @@ -125,6 +130,18 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
layout(doubleField)
).get(driverContext);
}
case "case_1_eager", "case_1_lazy" -> {
FieldAttribute f1 = longField();
FieldAttribute f2 = longField();
Expression condition = new Equals(Source.EMPTY, f1, new Literal(Source.EMPTY, 1L, DataType.LONG));
Expression lhs = f1;
Expression rhs = f2;
if (operation.endsWith("lazy")) {
lhs = new Add(Source.EMPTY, lhs, new Literal(Source.EMPTY, 1L, DataType.LONG));
rhs = new Add(Source.EMPTY, rhs, new Literal(Source.EMPTY, 1L, DataType.LONG));
}
yield EvalMapper.toEvaluator(new Case(Source.EMPTY, condition, List.of(lhs, rhs)), layout(f1, f2)).get(driverContext);
}
case "date_trunc" -> {
FieldAttribute timestamp = new FieldAttribute(
Source.EMPTY,
Expand Down Expand Up @@ -216,6 +233,28 @@ private static void checkExpected(String operation, Page actual) {
}
}
}
case "case_1_eager" -> {
LongVector f1 = actual.<LongBlock>getBlock(0).asVector();
LongVector f2 = actual.<LongBlock>getBlock(1).asVector();
LongVector result = actual.<LongBlock>getBlock(2).asVector();
for (int i = 0; i < BLOCK_LENGTH; i++) {
long expected = f1.getLong(i) == 1 ? f1.getLong(i) : f2.getLong(i);
if (result.getLong(i) != expected) {
throw new AssertionError("[" + operation + "] expected [" + expected + "] but was [" + result.getLong(i) + "]");
}
}
}
case "case_1_lazy" -> {
LongVector f1 = actual.<LongBlock>getBlock(0).asVector();
LongVector f2 = actual.<LongBlock>getBlock(1).asVector();
LongVector result = actual.<LongBlock>getBlock(2).asVector();
for (int i = 0; i < BLOCK_LENGTH; i++) {
long expected = 1 + (f1.getLong(i) == 1 ? f1.getLong(i) : f2.getLong(i));
if (result.getLong(i) != expected) {
throw new AssertionError("[" + operation + "] expected [" + expected + "] but was [" + result.getLong(i) + "]");
}
}
}
case "date_trunc" -> {
LongVector v = actual.<LongBlock>getBlock(1).asVector();
long oneDay = TimeValue.timeValueHours(24).millis();
Expand Down Expand Up @@ -280,6 +319,15 @@ private static Page page(String operation) {
}
yield new Page(builder.build());
}
case "case_1_eager", "case_1_lazy" -> {
var f1 = blockFactory.newLongBlockBuilder(BLOCK_LENGTH);
var f2 = blockFactory.newLongBlockBuilder(BLOCK_LENGTH);
for (int i = 0; i < BLOCK_LENGTH; i++) {
f1.appendLong(i);
f2.appendLong(-i);
}
yield new Page(f1.build(), f2.build());
}
case "long_equal_to_long" -> {
var lhs = blockFactory.newLongBlockBuilder(BLOCK_LENGTH);
var rhs = blockFactory.newLongBlockBuilder(BLOCK_LENGTH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

package org.elasticsearch.benchmark.tdigest;

import org.elasticsearch.common.breaker.NoopCircuitBreaker;
import org.elasticsearch.search.aggregations.metrics.MemoryTrackingTDigestArrays;
import org.elasticsearch.tdigest.Sort;
import org.elasticsearch.tdigest.arrays.TDigestArrays;
import org.elasticsearch.tdigest.arrays.TDigestDoubleArray;
import org.elasticsearch.tdigest.arrays.TDigestIntArray;
import org.elasticsearch.tdigest.arrays.WrapperTDigestArrays;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand All @@ -51,7 +53,8 @@
@State(Scope.Thread)
public class SortBench {
private final int size = 100000;
private final TDigestDoubleArray values = WrapperTDigestArrays.INSTANCE.newDoubleArray(size);
private final TDigestArrays arrays = new MemoryTrackingTDigestArrays(new NoopCircuitBreaker("default-wrapper-tdigest-arrays"));
private final TDigestDoubleArray values = arrays.newDoubleArray(size);

@Param({ "0", "1", "-1" })
public int sortDirection;
Expand All @@ -72,7 +75,7 @@ public void setup() {

@Benchmark
public void stableSort() {
TDigestIntArray order = WrapperTDigestArrays.INSTANCE.newIntArray(size);
TDigestIntArray order = arrays.newIntArray(size);
for (int i = 0; i < size; i++) {
order.set(i, i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

package org.elasticsearch.benchmark.tdigest;

import org.elasticsearch.common.breaker.NoopCircuitBreaker;
import org.elasticsearch.search.aggregations.metrics.MemoryTrackingTDigestArrays;
import org.elasticsearch.tdigest.MergingDigest;
import org.elasticsearch.tdigest.TDigest;
import org.elasticsearch.tdigest.arrays.WrapperTDigestArrays;
import org.elasticsearch.tdigest.arrays.TDigestArrays;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand Down Expand Up @@ -56,24 +58,25 @@
@Threads(1)
@State(Scope.Thread)
public class TDigestBench {
private static final TDigestArrays arrays = new MemoryTrackingTDigestArrays(new NoopCircuitBreaker("default-wrapper-tdigest-arrays"));

public enum TDigestFactory {
MERGE {
@Override
TDigest create(double compression) {
return new MergingDigest(WrapperTDigestArrays.INSTANCE, compression, (int) (10 * compression));
return new MergingDigest(arrays, compression, (int) (10 * compression));
}
},
AVL_TREE {
@Override
TDigest create(double compression) {
return TDigest.createAvlTreeDigest(WrapperTDigestArrays.INSTANCE, compression);
return TDigest.createAvlTreeDigest(arrays, compression);
}
},
HYBRID {
@Override
TDigest create(double compression) {
return TDigest.createHybridDigest(WrapperTDigestArrays.INSTANCE, compression);
return TDigest.createHybridDigest(arrays, compression);
}
};

Expand Down
4 changes: 2 additions & 2 deletions build-tools-internal/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=682b4df7fe5accdca84a4d1ef6a3a6ab096b3efd5edf7de2bd8c758d95a93703
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
distributionSha256Sum=fdfca5dbc2834f0ece5020465737538e5ba679deeff5ab6c09621d67f8bb1a15
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
vmParameters = [
'-ea',
'-Djava.security.manager=allow',
'-Djava.locale.providers=SPI,CLDR',
'-Djava.locale.providers=CLDR',
'-Des.nativelibs.path="' + testLibraryPath + '"',
// TODO: only open these for mockito when it is modularized
'--add-opens=java.base/java.security.cert=ALL-UNNAMED',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void execute(Task t) {
mkdirs(test.getWorkingDir().toPath().resolve("temp").toFile());

// TODO remove once jvm.options are added to test system properties
test.systemProperty("java.locale.providers", "SPI,CLDR");
test.systemProperty("java.locale.providers", "CLDR");
}
});
test.getJvmArgumentProviders().add(nonInputProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public class InternalDistributionModuleCheckTaskProvider {
"org.elasticsearch.nativeaccess",
"org.elasticsearch.plugin",
"org.elasticsearch.plugin.analysis",
"org.elasticsearch.pluginclassloader",
"org.elasticsearch.securesm",
"org.elasticsearch.server",
"org.elasticsearch.simdvec",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.compile.CompileOptions;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.api.tasks.javadoc.Javadoc;
import org.gradle.api.tasks.testing.Test;
import org.gradle.external.javadoc.CoreJavadocOptions;
import org.gradle.jvm.tasks.Jar;
import org.gradle.jvm.toolchain.JavaLanguageVersion;
import org.gradle.jvm.toolchain.JavaToolchainService;
Expand Down Expand Up @@ -73,8 +75,10 @@ public void apply(Project project) {
List<Integer> mainVersions = findSourceVersions(project);
List<String> mainSourceSets = new ArrayList<>();
mainSourceSets.add(SourceSet.MAIN_SOURCE_SET_NAME);
configurePreviewFeatures(project, javaExtension.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME), 21);
List<String> testSourceSets = new ArrayList<>(mainSourceSets);
testSourceSets.add(SourceSet.TEST_SOURCE_SET_NAME);
configurePreviewFeatures(project, javaExtension.getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME), 21);
for (int javaVersion : mainVersions) {
String mainSourceSetName = SourceSet.MAIN_SOURCE_SET_NAME + javaVersion;
SourceSet mainSourceSet = addSourceSet(project, javaExtension, mainSourceSetName, mainSourceSets, javaVersion);
Expand Down Expand Up @@ -124,11 +128,8 @@ private SourceSet addSourceSet(
compileTask.setSourceCompatibility(Integer.toString(javaVersion));
CompileOptions compileOptions = compileTask.getOptions();
compileOptions.getRelease().set(javaVersion);
compileOptions.getCompilerArgs().add("--enable-preview");
compileOptions.getCompilerArgs().add("-Xlint:-preview");

compileTask.doLast(t -> { stripPreviewFromFiles(compileTask.getDestinationDirectory().getAsFile().get().toPath()); });
});
configurePreviewFeatures(project, sourceSet, javaVersion);

// Since we configure MRJAR sourcesets to allow preview apis, class signatures for those
// apis are not known by forbidden apis, so we must ignore all missing classes. We could, in theory,
Expand All @@ -142,6 +143,21 @@ private SourceSet addSourceSet(
return sourceSet;
}

private void configurePreviewFeatures(Project project, SourceSet sourceSet, int javaVersion) {
project.getTasks().withType(JavaCompile.class).named(sourceSet.getCompileJavaTaskName()).configure(compileTask -> {
CompileOptions compileOptions = compileTask.getOptions();
compileOptions.getCompilerArgs().add("--enable-preview");
compileOptions.getCompilerArgs().add("-Xlint:-preview");

compileTask.doLast(t -> { stripPreviewFromFiles(compileTask.getDestinationDirectory().getAsFile().get().toPath()); });
});
project.getTasks().withType(Javadoc.class).named(name -> name.equals(sourceSet.getJavadocTaskName())).configureEach(javadocTask -> {
CoreJavadocOptions options = (CoreJavadocOptions) javadocTask.getOptions();
options.addBooleanOption("-enable-preview", true);
options.addStringOption("-release", String.valueOf(javaVersion));
});
}

private void configureSourceSetInJar(Project project, SourceSet sourceSet, int javaVersion) {
var jarTask = project.getTasks().withType(Jar.class).named(JavaPlugin.JAR_TASK_NAME);
jarTask.configure(task -> task.into("META-INF/versions/" + javaVersion, copySpec -> copySpec.from(sourceSet.getOutput())));
Expand Down
Loading

0 comments on commit ce1708a

Please sign in to comment.