-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add task retries smoke product test #22798
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
Merged
losipiuk
merged 2 commits into
trinodb:master
from
losipiuk:lukaszos/add-task-retries-smoke-product-test-cfbce9
Jul 26, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...uncher/src/main/java/io/trino/tests/product/launcher/env/common/TaskRetriesMultinode.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * 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.common; | ||
|
|
||
| import com.google.common.collect.ImmutableList; | ||
| import com.google.inject.Inject; | ||
| import io.trino.tests.product.launcher.docker.DockerFiles; | ||
| import io.trino.tests.product.launcher.env.Environment; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.COORDINATOR; | ||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.isTrinoWorker; | ||
| import static io.trino.tests.product.launcher.env.common.Standard.CONTAINER_TRINO_CONFIG_PROPERTIES; | ||
| import static java.util.Objects.requireNonNull; | ||
| import static org.testcontainers.utility.MountableFile.forHostPath; | ||
|
|
||
| public class TaskRetriesMultinode | ||
| implements EnvironmentExtender | ||
| { | ||
| private final StandardMultinode standardMultinode; | ||
| private final DockerFiles.ResourceProvider configDir; | ||
|
|
||
| @Inject | ||
| public TaskRetriesMultinode( | ||
| StandardMultinode standardMultinode, | ||
| DockerFiles dockerFiles) | ||
| { | ||
| this.standardMultinode = requireNonNull(standardMultinode, "standardMultinode is null"); | ||
| this.configDir = dockerFiles.getDockerFilesHostDirectory("common/task-retries-multinode"); | ||
| } | ||
|
|
||
| @Override | ||
| public List<EnvironmentExtender> getDependencies() | ||
| { | ||
| return ImmutableList.of(standardMultinode); | ||
| } | ||
|
|
||
| @Override | ||
| public void extendEnvironment(Environment.Builder builder) | ||
| { | ||
| builder.configureContainer(COORDINATOR, container -> container | ||
| .withCopyFileToContainer(forHostPath(configDir.getPath("multinode-master-config.properties")), CONTAINER_TRINO_CONFIG_PROPERTIES)); | ||
| builder.configureContainers(container -> { | ||
| if (isTrinoWorker(container.getLogicalName())) { | ||
| container.withCopyFileToContainer(forHostPath(configDir.getPath("multinode-worker-config.properties")), CONTAINER_TRINO_CONFIG_PROPERTIES); | ||
| } | ||
| }); | ||
| } | ||
| } |
88 changes: 88 additions & 0 deletions
88
...ests/product/launcher/env/environment/EnvMultinodeMinioDataLakeTaskRetriesFilesystem.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| /* | ||
| * 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.environment; | ||
|
|
||
| import com.google.inject.Inject; | ||
| import io.trino.tests.product.launcher.docker.DockerFiles; | ||
| import io.trino.tests.product.launcher.env.Environment; | ||
| import io.trino.tests.product.launcher.env.EnvironmentProvider; | ||
| import io.trino.tests.product.launcher.env.common.Hadoop; | ||
| import io.trino.tests.product.launcher.env.common.Minio; | ||
| import io.trino.tests.product.launcher.env.common.TaskRetriesMultinode; | ||
| import io.trino.tests.product.launcher.env.common.TestsEnvironment; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.UncheckedIOException; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.nio.file.attribute.FileAttribute; | ||
| import java.nio.file.attribute.PosixFilePermission; | ||
| import java.nio.file.attribute.PosixFilePermissions; | ||
| import java.util.Set; | ||
|
|
||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.TESTS; | ||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.isTrinoContainer; | ||
| import static io.trino.tests.product.launcher.env.common.Minio.MINIO_CONTAINER_NAME; | ||
| import static io.trino.tests.product.launcher.env.common.Standard.CONTAINER_TRINO_ETC; | ||
| import static org.testcontainers.utility.MountableFile.forHostPath; | ||
|
|
||
| /** | ||
| * Trino with S3-compatible Data Lake setup based on MinIO. | ||
| * Task retries enabled using Filesystem exchange backed by MinIO. | ||
| */ | ||
| @TestsEnvironment | ||
| public class EnvMultinodeMinioDataLakeTaskRetriesFilesystem | ||
| extends EnvironmentProvider | ||
| { | ||
| private static final String S3_BUCKET_NAME = "test-bucket"; | ||
|
|
||
| private final DockerFiles.ResourceProvider configDir; | ||
|
|
||
| @Inject | ||
| public EnvMultinodeMinioDataLakeTaskRetriesFilesystem(TaskRetriesMultinode taskRetriesMultinode, Hadoop hadoop, Minio minio, DockerFiles dockerFiles) | ||
| { | ||
| super(taskRetriesMultinode, hadoop, minio); | ||
| this.configDir = dockerFiles.getDockerFilesHostDirectory("conf/environment/multinode-minio-data-lake-task-retries-filesystem"); | ||
| } | ||
|
|
||
| @Override | ||
| public void extendEnvironment(Environment.Builder builder) | ||
| { | ||
| builder.configureContainer(TESTS, dockerContainer -> { | ||
| dockerContainer.withEnv("S3_BUCKET", S3_BUCKET_NAME); | ||
| }); | ||
|
|
||
| // initialize buckets in minio | ||
| FileAttribute<Set<PosixFilePermission>> posixFilePermissions = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-r--r--")); | ||
| Path minioBucketDirectory; | ||
| try { | ||
| minioBucketDirectory = Files.createTempDirectory("test-bucket-contents", posixFilePermissions); | ||
| minioBucketDirectory.toFile().deleteOnExit(); | ||
| } | ||
| catch (IOException e) { | ||
| throw new UncheckedIOException(e); | ||
| } | ||
| builder.configureContainer(MINIO_CONTAINER_NAME, container -> | ||
| container.withCopyFileToContainer(forHostPath(minioBucketDirectory), "/data/" + S3_BUCKET_NAME)); | ||
|
|
||
| builder.addConnector("iceberg", forHostPath(configDir.getPath("iceberg.properties"))); | ||
|
|
||
| // configure exchange mananger | ||
| builder.configureContainers(container -> { | ||
| if (isTrinoContainer(container.getLogicalName())) { | ||
| container.withCopyFileToContainer(forHostPath(configDir.getPath("exchange-manager.properties")), CONTAINER_TRINO_ETC + "/exchange-manager.properties"); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ker/presto-product-tests/common/task-retries-multinode/multinode-master-config.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| node.id=will-be-overwritten | ||
| node.environment=test | ||
|
|
||
| coordinator=true | ||
| experimental.concurrent-startup=true | ||
| node-scheduler.include-coordinator=false | ||
| http-server.http.port=8080 | ||
| query.max-memory=1GB | ||
| discovery.uri=http://presto-master:8080 | ||
|
|
||
| # Use task.min-writer-count > 1, as this allows to expose writer-concurrency related bugs. | ||
| task.min-writer-count=2 | ||
| task.concurrency=2 | ||
| task.max-writer-count=2 | ||
|
|
||
| # Enable task retries | ||
| retry-policy=task |
17 changes: 17 additions & 0 deletions
17
...ker/presto-product-tests/common/task-retries-multinode/multinode-worker-config.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| node.id=will-be-overwritten | ||
| node.environment=test | ||
|
|
||
| coordinator=false | ||
| experimental.concurrent-startup=true | ||
| http-server.http.port=8081 | ||
| query.max-memory=1GB | ||
| query.max-memory-per-node=1GB | ||
| discovery.uri=http://presto-master:8080 | ||
|
|
||
| # Use task.min-writer-count > 1, as this allows to expose writer-concurrency related bugs. | ||
| task.min-writer-count=2 | ||
| task.concurrency=2 | ||
| task.max-writer-count=2 | ||
|
|
||
| # Enable task retries | ||
| retry-policy=task |
7 changes: 7 additions & 0 deletions
7
...environment/multinode-minio-data-lake-task-retries-filesystem/exchange-manager.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| exchange-manager.name=filesystem | ||
| exchange.s3.endpoint=http://minio:9080/ | ||
| exchange.s3.region=us-west-1 | ||
| exchange.s3.aws-access-key=minio-access-key | ||
| exchange.s3.aws-secret-key=minio-secret-key | ||
| exchange.s3.path-style-access=true | ||
| exchange.base-directories=s3://test-bucket |
10 changes: 10 additions & 0 deletions
10
...sts/conf/environment/multinode-minio-data-lake-task-retries-filesystem/iceberg.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| connector.name=iceberg | ||
| hive.metastore.uri=thrift://hadoop-master:9083 | ||
| fs.native-s3.enabled=true | ||
| fs.hadoop.enabled=false | ||
| s3.region=us-east-1 | ||
| s3.aws-access-key=minio-access-key | ||
| s3.aws-secret-key=minio-secret-key | ||
| s3.endpoint=http://minio:9080/ | ||
| s3.path-style-access=true | ||
| iceberg.file-format=PARQUET |
32 changes: 32 additions & 0 deletions
32
...ts/src/main/java/io/trino/tests/product/faulttolerant/TestTaskRetriesFilesystemSmoke.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * 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.faulttolerant; | ||
|
|
||
| import io.trino.tempto.ProductTest; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import static io.trino.tests.product.TestGroups.FAULT_TOLERANT; | ||
| import static io.trino.tests.product.utils.QueryExecutors.onTrino; | ||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| public class TestTaskRetriesFilesystemSmoke | ||
| extends ProductTest | ||
| { | ||
| @Test(groups = FAULT_TOLERANT) | ||
| public void testSimpleQuery() | ||
| { | ||
| assertThat(onTrino().executeQuery("select count(*) from tpch.sf1.lineitem where orderkey < 100").getOnlyValue()) | ||
| .isEqualTo(105L); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to expose minio data to the host?