Skip to content

Commit 42ea7c3

Browse files
committed
Remove signer override
It's no longer needed since AWS SDK v2 added a LegacyMd5Plugin to ensure backward compatibility with S3-compliant storage.
1 parent bf8da03 commit 42ea7c3

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ private void deleteObjects(Collection<Location> locations)
199199
.overrideConfiguration(context::applyCredentialProviderOverride)
200200
.requestPayer(requestPayer)
201201
.bucket(bucket)
202-
.overrideConfiguration(disableStrongIntegrityChecksums())
203202
.delete(builder -> builder.objects(objects).quiet(true))
204203
.build();
205204

@@ -394,14 +393,4 @@ private static void validateS3Location(Location location)
394393
{
395394
new S3Location(location);
396395
}
397-
398-
// TODO (https://github.com/trinodb/trino/issues/24955):
399-
// remove me once all of the S3-compatible storage support strong integrity checks
400-
@SuppressWarnings("deprecation")
401-
static AwsRequestOverrideConfiguration disableStrongIntegrityChecksums()
402-
{
403-
return AwsRequestOverrideConfiguration.builder()
404-
.signer(AwsS3V4Signer.create())
405-
.build();
406-
}
407396
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
import static com.google.common.collect.Iterables.getOnlyElement;
4343
import static io.trino.filesystem.encryption.EncryptionKey.randomAes256;
44-
import static io.trino.filesystem.s3.S3FileSystem.disableStrongIntegrityChecksums;
4544
import static io.trino.filesystem.s3.S3SseCUtils.encoded;
4645
import static io.trino.filesystem.s3.S3SseCUtils.md5Checksum;
4746
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -157,7 +156,6 @@ void testFileWithTrailingWhitespaceAgainstNativeClient()
157156
builder.sseCustomerKeyMD5(md5Checksum(randomEncryptionKey));
158157
}
159158
})
160-
.overrideConfiguration(disableStrongIntegrityChecksums())
161159
.build();
162160

163161
s3Client.putObject(putObjectRequest, RequestBody.fromBytes(contents.clone()));
@@ -273,9 +271,7 @@ public TempDirectory(S3Client s3Client, String path)
273271

274272
public void create()
275273
{
276-
s3Client.putObject(request -> request
277-
.overrideConfiguration(disableStrongIntegrityChecksums())
278-
.bucket(bucket()).key(path), RequestBody.empty());
274+
s3Client.putObject(request -> request.bucket(bucket()).key(path), RequestBody.empty());
279275
}
280276

281277
@Override

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import java.util.List;
3030

3131
import static com.google.common.collect.Iterables.getOnlyElement;
32-
import static io.trino.filesystem.s3.S3FileSystem.disableStrongIntegrityChecksums;
3332
import static io.trino.testing.SystemEnvironmentUtils.requireEnv;
3433
import static org.assertj.core.api.Assertions.assertThat;
3534

@@ -88,7 +87,6 @@ void testS3FileIteratorFileEntryTags()
8887
.bucket(bucket())
8988
.key(key)
9089
.storageClass(storageClass.toString())
91-
.overrideConfiguration(disableStrongIntegrityChecksums())
9290
.build();
9391
s3Client.putObject(
9492
putObjectRequestBuilder,

testing/trino-testing-containers/src/main/java/io/trino/testing/containers/MotoContainer.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@
1717
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
1818
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
1919
import software.amazon.awssdk.awscore.client.builder.AwsClientBuilder;
20+
import software.amazon.awssdk.core.checksums.RequestChecksumCalculation;
2021
import software.amazon.awssdk.regions.Region;
22+
import software.amazon.awssdk.services.s3.LegacyMd5Plugin;
2123
import software.amazon.awssdk.services.s3.S3Client;
2224
import software.amazon.awssdk.services.s3.S3ClientBuilder;
2325

2426
import java.net.URI;
2527

28+
import static software.amazon.awssdk.core.checksums.ResponseChecksumValidation.WHEN_REQUIRED;
29+
2630
public final class MotoContainer
2731
extends GenericContainer<MotoContainer>
2832
{
@@ -51,7 +55,10 @@ public void updateClient(AwsClientBuilder<?, ?> client)
5155
AwsBasicCredentials.create(MOTO_ACCESS_KEY, MOTO_SECRET_KEY)));
5256
if (client instanceof S3ClientBuilder s3) {
5357
s3.forcePathStyle(true);
58+
s3.responseChecksumValidation(WHEN_REQUIRED);
59+
s3.requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED);
5460
}
61+
client.addPlugin(LegacyMd5Plugin.create());
5562
}
5663

5764
public void createBucket(String bucketName)

0 commit comments

Comments
 (0)