Skip to content

Commit d16f83f

Browse files
committed
Improve compatibility with S3-compliant storages
For rationale: aws/aws-sdk-java-v2#6055
1 parent ddb5a23 commit d16f83f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/trino-filesystem-s3/src/main/java/io/trino/filesystem/s3/S3FileSystemLoader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import software.amazon.awssdk.http.apache.ProxyConfiguration;
3232
import software.amazon.awssdk.metrics.MetricPublisher;
3333
import software.amazon.awssdk.regions.Region;
34+
import software.amazon.awssdk.services.s3.LegacyMd5Plugin;
3435
import software.amazon.awssdk.services.s3.S3Client;
3536
import software.amazon.awssdk.services.s3.S3ClientBuilder;
3637
import software.amazon.awssdk.services.s3.S3Configuration;
@@ -182,6 +183,7 @@ private static S3ClientFactory s3ClientFactory(SdkHttpClient httpClient, OpenTel
182183
s3.httpClient(httpClient);
183184
s3.responseChecksumValidation(WHEN_REQUIRED);
184185
s3.requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED);
186+
s3.addPlugin(LegacyMd5Plugin.create());
185187

186188
region.map(Region::of).ifPresent(s3::region);
187189
endpoint.map(URI::create).ifPresent(s3::endpointOverride);

lib/trino-filesystem-s3/src/test/java/io/trino/filesystem/s3/TestS3FileSystemMinIo.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
import org.junit.jupiter.api.Test;
2121
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
2222
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
23-
import software.amazon.awssdk.core.checksums.RequestChecksumCalculation;
2423
import software.amazon.awssdk.regions.Region;
2524
import software.amazon.awssdk.services.s3.S3Client;
2625

2726
import java.io.IOException;
2827
import java.net.URI;
2928

3029
import static org.assertj.core.api.Assertions.assertThatThrownBy;
31-
import static software.amazon.awssdk.core.checksums.ResponseChecksumValidation.WHEN_REQUIRED;
3230

3331
public class TestS3FileSystemMinIo
3432
extends AbstractTestS3FileSystem
@@ -67,8 +65,6 @@ protected S3Client createS3Client()
6765
.endpointOverride(URI.create(minio.getMinioAddress()))
6866
.region(Region.of(Minio.MINIO_REGION))
6967
.forcePathStyle(true)
70-
.responseChecksumValidation(WHEN_REQUIRED)
71-
.requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED)
7268
.credentialsProvider(StaticCredentialsProvider.create(
7369
AwsBasicCredentials.create(Minio.MINIO_ACCESS_KEY, Minio.MINIO_SECRET_KEY)))
7470
.build();

plugin/trino-exchange-filesystem/src/main/java/io/trino/plugin/exchange/filesystem/s3/S3FileSystemExchangeStorage.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import software.amazon.awssdk.core.internal.retry.SdkDefaultRetryStrategy;
6464
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
6565
import software.amazon.awssdk.regions.Region;
66+
import software.amazon.awssdk.services.s3.LegacyMd5Plugin;
6667
import software.amazon.awssdk.services.s3.S3AsyncClient;
6768
import software.amazon.awssdk.services.s3.S3AsyncClientBuilder;
6869
import software.amazon.awssdk.services.s3.S3Configuration;
@@ -487,6 +488,7 @@ private S3AsyncClient createS3AsyncClient(
487488
.build())
488489
.requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED)
489490
.responseChecksumValidation(ResponseChecksumValidation.WHEN_REQUIRED)
491+
.addPlugin(LegacyMd5Plugin.create())
490492
.httpClientBuilder(NettyNioAsyncHttpClient.builder()
491493
.maxConcurrency(maxConcurrency)
492494
.maxPendingConnectionAcquires(maxPendingConnectionAcquires)

0 commit comments

Comments
 (0)