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

Change TaskId.fullId creation to mitigate probable JDK bug #18293

Merged
merged 2 commits into from
Aug 23, 2023
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
matrix:
java-version:
- 17
- 19
- 20
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -566,7 +566,7 @@ jobs:
- lib/trino-filesystem-s3
- lib/trino-hdfs
- { modules: core/trino-main }
- { modules: core/trino-main, jdk: 19 }
- { modules: core/trino-main, jdk: 20 }
- { modules: lib/trino-filesystem-s3, profile: cloud-tests }
- { modules: plugin/trino-accumulo }
- { modules: plugin/trino-bigquery }
Expand Down
7 changes: 6 additions & 1 deletion core/trino-main/src/main/java/io/trino/execution/TaskId.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import static io.airlift.slice.SizeOf.instanceSize;
import static io.trino.spi.QueryId.parseDottedId;
import static java.lang.Integer.parseInt;
import static java.lang.String.join;
import static java.util.Objects.requireNonNull;

public class TaskId
Expand All @@ -44,7 +45,11 @@ public TaskId(StageId stageId, int partitionId, int attemptId)
requireNonNull(stageId, "stageId is null");
checkArgument(partitionId >= 0, "partitionId is negative: %s", partitionId);
checkArgument(attemptId >= 0, "attemptId is negative: %s", attemptId);
this.fullId = stageId + "." + partitionId + "." + attemptId;

// There is a strange JDK bug related to the CompactStrings implementation in JDK20+ which causes some fullId values
// to get corrupted when this particular line is JIT-optimized. Changing implicit concatenation to a String.join call
// seems to mitigate this issue. See: https://github.com/trinodb/trino/issues/18272 for more details.
this.fullId = join(".", stageId.toString(), String.valueOf(partitionId), String.valueOf(attemptId));
}

private TaskId(String fullId)
Expand Down