From e953a3ec04398d68c62d010e391edf9df8a39a33 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 4 Oct 2024 16:46:39 +0200 Subject: [PATCH] Allow Kafka's SASL to use security manager under JDK 23 --- .../EnvMultinodeKafkaSaslPlaintext.java | 11 ++++++---- .../multinode-kafka-sasl-plaintext/jvm.config | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 testing/trino-product-tests-launcher/src/main/resources/docker/trino-product-tests/conf/environment/multinode-kafka-sasl-plaintext/jvm.config diff --git a/testing/trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/env/environment/EnvMultinodeKafkaSaslPlaintext.java b/testing/trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/env/environment/EnvMultinodeKafkaSaslPlaintext.java index a84b408a97fc1..f723c6bb5b5f2 100644 --- a/testing/trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/env/environment/EnvMultinodeKafkaSaslPlaintext.java +++ b/testing/trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/env/environment/EnvMultinodeKafkaSaslPlaintext.java @@ -29,6 +29,7 @@ import static io.trino.tests.product.launcher.env.EnvironmentContainers.WORKER; import static io.trino.tests.product.launcher.env.EnvironmentContainers.configureTempto; import static io.trino.tests.product.launcher.env.common.Standard.CONTAINER_TRINO_ETC; +import static io.trino.tests.product.launcher.env.common.Standard.CONTAINER_TRINO_JVM_CONFIG; import static java.util.Objects.requireNonNull; import static org.testcontainers.utility.MountableFile.forHostPath; @@ -49,8 +50,8 @@ public EnvMultinodeKafkaSaslPlaintext(KafkaSaslPlaintext kafka, StandardMultinod @Override public void extendEnvironment(Environment.Builder builder) { - builder.configureContainer(COORDINATOR, this::addCatalogs); - builder.configureContainer(WORKER, this::addCatalogs); + builder.configureContainer(COORDINATOR, this::configureTrino); + builder.configureContainer(WORKER, this::configureTrino); builder.addConnector("kafka"); configureTempto(builder, configDir); @@ -60,7 +61,7 @@ public void extendEnvironment(Environment.Builder builder) CONTAINER_TRINO_ETC + "/kafka-configuration.properties")); } - private void addCatalogs(DockerContainer container) + private void configureTrino(DockerContainer container) { container .withCopyFileToContainer( @@ -71,6 +72,8 @@ private void addCatalogs(DockerContainer container) CONTAINER_TRINO_ETC + "/catalog/kafka.properties") .withCopyFileToContainer( forHostPath(configDir.getPath("kafka-configuration.properties")), - CONTAINER_TRINO_ETC + "/kafka-configuration.properties"); + CONTAINER_TRINO_ETC + "/kafka-configuration.properties") + .withCopyFileToContainer(forHostPath(configDir.getPath("jvm.config")), + CONTAINER_TRINO_JVM_CONFIG); } } diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/trino-product-tests/conf/environment/multinode-kafka-sasl-plaintext/jvm.config b/testing/trino-product-tests-launcher/src/main/resources/docker/trino-product-tests/conf/environment/multinode-kafka-sasl-plaintext/jvm.config new file mode 100644 index 0000000000000..6e54e55cc00e6 --- /dev/null +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/trino-product-tests/conf/environment/multinode-kafka-sasl-plaintext/jvm.config @@ -0,0 +1,21 @@ +-server +-Xmx2G +-XX:G1HeapRegionSize=32M +-XX:+ExplicitGCInvokesConcurrent +-XX:+ExitOnOutOfMemoryError +-XX:+HeapDumpOnOutOfMemoryError +-XX:-OmitStackTraceInFastThrow +-XX:ReservedCodeCacheSize=150M +-XX:PerMethodRecompilationCutoff=10000 +-XX:PerBytecodeRecompilationCutoff=10000 +-Djdk.attach.allowAttachSelf=true +# jdk.nio.maxCachedBufferSize controls what buffers can be allocated in per-thread "temporary buffer cache" (sun.nio.ch.Util). Value of 0 disables the cache. +-Djdk.nio.maxCachedBufferSize=0 +-DHADOOP_USER_NAME=hive +-Duser.timezone=Asia/Kathmandu +-XX:ErrorFile=/docker/logs/product-tests-presto-jvm-error-file.log +# Allow loading dynamic agent used by JOL +-XX:+EnableDynamicAgentLoading +-XX:+UnlockDiagnosticVMOptions +# https://bugs.openjdk.org/browse/JDK-8327134a +-Djava.security.manager=allow