AWS: Add s3.checksum-algorithm property to configure the SDK checksum algorithm - #17179
moomindani wants to merge 2 commits into
Conversation
|
Not stale — no review yet. CI is green (39/39). Follow-up to #17177: adds This one stacks on #17177, so it makes sense to review that one first. @nastra @singhpk234 @amogh-jahagirdar a review would be appreciated whenever you have a moment. |
… algorithm Adds a property to select the checksum algorithm the AWS SDK uses for data integrity protection on S3 upload requests (PutObject, CreateMultipartUpload, UploadPart). When unset, the AWS SDK default (CRC32) is left unchanged. Part checksums returned by UploadPart are passed on to CompleteMultipartUpload as S3 requires when an algorithm is specified.
a9b92f2 to
41905e0
Compare
|
@singhpk234 first, a correction to what I wrote here on 7 August: I said this PR stacks on #17177 and that it made sense to review that one first. That is not true — this branch comes off On its own terms: One open naming question, also in the PR body: |
|
@CTTY this is the companion to #17177 and independent of it — separate branch, no shared commits, reviewable on its own and in either order. There is one naming question in the PR body — |
This PR adds a new S3FileIO property to select the checksum algorithm the AWS SDK uses for data integrity protection on S3 upload requests:
s3.checksum-algorithm: valid values are the algorithms supported by S3 —CRC32,CRC32C,CRC64NVME,SHA1,SHA256, and (since AWS SDK 2.42.x)MD5,SHA512,XXHASH3,XXHASH64,XXHASH128— case-insensitive. When unset, the AWS SDK default algorithm (CRC32) is used, so there is no behavior change.Background
S3FileIO has no way to choose the checksum algorithm today; the SDK always uses its default (CRC32). Users may want
CRC64NVMEfor efficient full-object integrity checks of multipart uploads, orSHA256where a cryptographic hash is required. See #17178 for details.Usage
Set the catalog property
s3.checksum-algorithmto the desired algorithm name, e.g. with Spark:Naming
The property is named
s3.checksum-algorithmto sit alongside the existings3.checksum-enabled, which also concerns upload checksums. An alternative considered wass3.write.checksum-algorithm, following thes3.write.*convention used for other upload-only properties (e.g.s3.write.storage-class), since this property only affects upload requests. Open to renaming if reviewers prefer that convention. For reference, Hadoop S3A calls the equivalent optionfs.s3a.create.checksum.algorithm.Implementation notes
S3OutputStream(PutObjectRequest,CreateMultipartUploadRequest,UploadPartRequest).UploadPartare passed on toCompleteMultipartUploadviaCompletedPart; S3 rejects the completion withInvalidPartotherwise when an algorithm is specified.when_required(see AWS: Add properties to configure SDK request checksum calculation and response checksum validation #17177).Testing
TestS3FileIOPropertiesfor parsing (case-insensitivity, invalid values, unset leaves the SDK default untouched)TestS3OutputStream#testWriteWithChecksumAlgorithmverifying the algorithm is applied to PutObject, CreateMultipartUpload, and UploadPart requestsCRC64NVMEandSHA256, for both single PUT and multipart uploads: request headers carry the configured algorithm (x-amz-sdk-checksum-algorithm/x-amz-checksum-*trailers), uploads and reads succeed, and content roundtrips correctly.Fixes #17178