Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serafin/try loom build #22489

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ runs:
if: ${{ format('{0}', inputs.cleanup-node) == 'true' }}
shell: bash
run: ./.github/bin/free-disk-space.sh
- name: "Download JDK package"
shell: bash
run: |
download_url="https://download.java.net/java/early_access/loom/1/openjdk-24-loom+1-17_linux-x64_bin.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4
if: ${{ inputs.java-version != '' }}
with:
distribution: 'temurin' # use same JDK distro as in Trino docker images
java-version: ${{ inputs.java-version }}
distribution: jdkfile
java-version: 24-ea
jdkFile: ${{ runner.temp }}/java_package.tar.gz
- name: Cache and Restore local Maven repo
id: cache
if: ${{ format('{0}', inputs.cache) == 'true' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public ThreadPerDriverTaskExecutor(TaskManagerConfig config, Tracer tracer, Vers
this(
tracer,
versionEmbedder,
new FairScheduler(config.getMaxWorkerThreads(), "SplitRunner-%d", Ticker.systemTicker()),
new FairScheduler(config.getMaxWorkerThreads(), "SplitRunner#", Ticker.systemTicker()),
config.getMinDriversPerTask(),
config.getMaxDriversPerTask(),
config.getMinDrivers());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.errorprone.annotations.ThreadSafe;
import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.airlift.log.Logger;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;

import java.util.Set;
import java.util.StringJoiner;
Expand Down Expand Up @@ -67,10 +68,14 @@ public FairScheduler(int maxConcurrentTasks, String threadNameFormat, Ticker tic
this.ticker = requireNonNull(ticker, "ticker is null");

concurrencyControl = new Reservation<>(maxConcurrentTasks);

schedulerExecutor = Executors.newCachedThreadPool(daemonThreadsNamed("fair-scheduler-%d"));
taskExecutor = MoreExecutors.listeningDecorator(createExecutor(threadNameFormat));
}

taskExecutor = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool(daemonThreadsNamed(threadNameFormat)));
@SuppressModernizer
private static ExecutorService createExecutor(String threadNameFormat)
{
return Executors.newThreadPerTaskExecutor(Thread.ofVirtual().name(threadNameFormat).factory());
}

public static FairScheduler newInstance(int maxConcurrentTasks)
Expand All @@ -80,7 +85,7 @@ public static FairScheduler newInstance(int maxConcurrentTasks)

public static FairScheduler newInstance(int maxConcurrentTasks, Ticker ticker)
{
FairScheduler scheduler = new FairScheduler(maxConcurrentTasks, "fair-scheduler-runner-%d", ticker);
FairScheduler scheduler = new FairScheduler(maxConcurrentTasks, "fair-scheduler-runner#", ticker);
scheduler.start();
return scheduler;
}
Expand Down
15 changes: 15 additions & 0 deletions core/trino-main/src/main/java/io/trino/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import static com.google.common.collect.MoreCollectors.toOptional;
import static io.airlift.discovery.client.ServiceAnnouncement.ServiceAnnouncementBuilder;
import static io.airlift.discovery.client.ServiceAnnouncement.serviceAnnouncement;
import static io.airlift.http.server.HttpServerBinder.httpServerBinder;
import static io.trino.server.TrinoSystemRequirements.verifySystemRequirements;
import static java.lang.String.format;
import static java.nio.file.LinkOption.NOFOLLOW_LINKS;
Expand All @@ -95,6 +96,7 @@ public final void start(String trinoVersion)

private void doStart(String trinoVersion)
{
fixJavaVersionWorkaround();
// Trino server behavior does not depend on locale settings.
// Use en_US as this is what Trino is tested with.
Locale.setDefault(Locale.US);
Expand All @@ -110,6 +112,7 @@ private void doStart(String trinoVersion)
new NodeModule(),
new DiscoveryModule(),
new HttpServerModule(),
binder -> httpServerBinder(binder).enableVirtualThreads(),
new JsonModule(),
new JaxrsModule(),
new MBeanModule(),
Expand Down Expand Up @@ -288,4 +291,16 @@ private static void logLocation(Logger log, String name, Path path)
}
log.info("%s: %s", name, path);
}

private static void fixJavaVersionWorkaround()
{
String version = System.getProperty(StandardSystemProperty.JAVA_VERSION.key());
if (version.endsWith("-ea")) {
version = version.substring(0, version.length() - 3);
}
if (version.endsWith("-beta")) {
version = version.substring(0, version.length() - 4);
}
System.setProperty(StandardSystemProperty.JAVA_VERSION.key(), version);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected TaskExecutor createTaskExecutor()
return new ThreadPerDriverTaskExecutor(
Tracing.noopTracer(),
testingVersionEmbedder(),
new FairScheduler(8, "Runner-%d", Ticker.systemTicker()),
new FairScheduler(8, "Runner#", Ticker.systemTicker()),
1,
Integer.MAX_VALUE,
8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testYielding()
throws ExecutionException, InterruptedException
{
TestingTicker ticker = new TestingTicker();
FairScheduler scheduler = new FairScheduler(1, "Runner-%d", ticker);
FairScheduler scheduler = new FairScheduler(1, "Runner#", ticker);
ThreadPerDriverTaskExecutor executor = new ThreadPerDriverTaskExecutor(noopTracer(), testingVersionEmbedder(), scheduler, 1, Integer.MAX_VALUE, Integer.MAX_VALUE);
executor.start();

Expand Down
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
-XX:+EnableDynamicAgentLoading
<!-- workaround for JDK-8329528 -->
-XX:G1NumCollectionsKeepPinned=10000000
-Djava.security.manager=allow
<!-- workaround for alluxio -->
-Djava.version=24
${extraJavaVectorArgs}
</air.test.jvm.additional-arguments.default>
<air.test.jvm.additional-arguments>${air.test.jvm.additional-arguments.default}</air.test.jvm.additional-arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.trino.tests.product.launcher.env.common.StandardMultinode;
import io.trino.tests.product.launcher.env.jdk.BuiltInJdkProvider;
import io.trino.tests.product.launcher.env.jdk.JdkProvider;
import io.trino.tests.product.launcher.env.jdk.LoomEaJdkProvider;
import io.trino.tests.product.launcher.env.jdk.TemurinReleaseJdkProvider;
import io.trino.tests.product.launcher.testcontainers.PortBinder;

Expand All @@ -45,6 +46,7 @@
import static io.trino.tests.product.launcher.Configurations.nameForConfigClass;
import static io.trino.tests.product.launcher.Configurations.nameForEnvironmentClass;
import static io.trino.tests.product.launcher.env.jdk.BuiltInJdkProvider.BUILT_IN_NAME;
import static io.trino.tests.product.launcher.env.jdk.LoomEaJdkProvider.LOOM_EA;
import static java.util.Locale.ENGLISH;
import static java.util.Objects.requireNonNull;
import static java.util.Objects.requireNonNullElse;
Expand Down Expand Up @@ -113,6 +115,9 @@ public JdkProvider provideJdk(EnvironmentOptions options)
if (version.equals(BUILT_IN_NAME)) {
return new BuiltInJdkProvider();
}
if (version.equals(LOOM_EA)) {
return new LoomEaJdkProvider(options.jdkDownloadPath);
}
return new TemurinReleaseJdkProvider(version, options.jdkDownloadPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static io.trino.tests.product.launcher.env.EnvironmentContainers.COORDINATOR;
import static io.trino.tests.product.launcher.env.jdk.BuiltInJdkProvider.BUILT_IN_NAME;
import static io.trino.tests.product.launcher.env.jdk.LoomEaJdkProvider.LOOM_EA;
import static java.util.Locale.ENGLISH;
import static picocli.CommandLine.Option;

Expand Down Expand Up @@ -60,7 +61,7 @@ public final class EnvironmentOptions
@Option(names = "--launcher-bin", paramLabel = "<launcher bin>", description = "Launcher bin path (used to display run commands)", defaultValue = "${launcher.bin}", hidden = true)
public String launcherBin;

@Option(names = {"--trino-jdk-version", "--temurin-release"}, paramLabel = "<release-name>", description = {"Temurin JDK release to run Trino with " + DEFAULT_VALUE, "See: https://api.adoptium.net/q/swagger-ui/#/Release%20Info/getReleaseNames"}, defaultValue = "${temurin.release}")
@Option(names = {"--trino-jdk-version", "--temurin-release"}, paramLabel = "<release-name>", description = {"Temurin JDK release to run Trino with " + DEFAULT_VALUE, "See: https://api.adoptium.net/q/swagger-ui/#/Release%20Info/getReleaseNames"}, defaultValue = LOOM_EA)
public String jdkVersion = BUILT_IN_NAME;

@Option(names = "--jdk-tmp-download-path", paramLabel = "<jdk-tmp-download-path>", defaultValue = "${env:PTL_TMP_DOWNLOAD_PATH:-${sys:java.io.tmpdir}/ptl-tmp-download}", description = "Path to use to download JDK distributions " + DEFAULT_VALUE)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Licensed 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 io.trino.tests.product.launcher.env.jdk;

import io.trino.testing.containers.TestContainers.DockerArchitecture;

import java.nio.file.Path;

public class LoomEaJdkProvider
extends TarDownloadingJdkProvider
{
public static final String LOOM_EA = "loom-ea";

public LoomEaJdkProvider(Path jdkDownloadPath)
{
super(jdkDownloadPath);
}

@Override
protected String getDownloadUri(DockerArchitecture architecture)
{
return switch (architecture) {
case AMD64 -> "https://download.java.net/java/early_access/loom/1/openjdk-24-loom+1-17_linux-x64_bin.tar.gz";
case ARM64 -> "https://download.java.net/java/early_access/loom/1/openjdk-24-loom+1-17_linux-aarch64_bin.tar.gz";
default -> throw new UnsupportedOperationException("Fetching Loom EA for arch " + architecture + " is not supported");
};
}

@Override
protected String getName()
{
return "24-loom+1-17";
}

@Override
public String getDescription()
{
return "Loom EA build";
}
}
Loading