Repository navigation
Description
Found while testing site replication of multipart uploads with full-object checksums.
A multipart object uploaded with x-amz-checksum-algorithm: CRC32 (or CRC32C) and x-amz-checksum-type: FULL_OBJECT never replicates. The source marks the version FAILED and the object never appears on the target. Every attempt fails on the target's CompleteMultipartUpload with 400 BadDigest. A server-side copy of such an object fails the same way.
Expected Behavior
The object replicates, and the replica has the same FULL_OBJECT checksum as the source.
Current Behavior
mc stat on the source shows Replication Status: FAILED, and the object is not listed on the target. The source logs this on every attempt:
Error: unable to replicate for object repro/obj(<version-id>): to (target: http://127.0.0.1:9103): The CRC32 you specified did not match the calculated checksum. (*fmt.wrapError)
On the target, mc admin trace --errors shows [400 Bad Request] s3.CompleteMultipartUpload 127.0.0.1:9103/repro/obj, with <Code>BadDigest</Code><Message>The CRC32 you specified did not match the calculated checksum.</Message>. CRC32C fails the same way.
Each retry sends the whole object to the target again and fails at the last step. A HeadObject on a FAILED object queues another attempt (cmd/object-handlers.go:945, :985), so clients that poll the object keep re-sending it.
A CopyObject of such an object to another key also stays FAILED, with the same error on the target.
Not affected; these replicate with the same checksum on the replica:
- multipart CRC64NVME (its default type is FULL_OBJECT),
- multipart COMPOSITE CRC32, CRC32C and SHA256,
- single-part PUT with any checksum.
Possible Solution
getCRCMeta drops x-amz-checksum-type from the replication headers (cmd/bucket-replication.go:4246):
for k, v := range cs {
if k == xhttp.AmzChecksumType {
continue
}For a multipart object with a FULL_OBJECT CRC32 checksum:
putReplicationOpts(cmd/bucket-replication.go:879) builds the target'sNewMultipartUploadoptions fromgetCRCMeta:x-amz-checksum-algorithm: CRC32, no type.replicateObjectWithMultipartopens the upload (:1835). Without a type the target creates a COMPOSITE CRC32 upload.- On completion (
:1932) the source sends the object checksum, which is the CRC of the whole object. - The target's composite branch (
cmd/erasure-multipart.go:1586) compares it with the checksum of the part checksums. They differ, so the target returnsBadDigest.
The copy keeps the multipart FULL_OBJECT checksum of its source, but its ETag is not a multipart ETag. putReplicationOpts has a shortcut for exactly this case: it replicates the object with a single PUT when the type is FULL_OBJECT (:883). That check reads the type from getCRCMeta, so it never fires. The copy goes through replicateObjectWithMultipart instead and fails as above.
The completion-side fixes c859041 (part checksums are optional for FULL_OBJECT completions) and 7e079ff (validate an explicit x-amz-checksum-type on completion) do not help. Both act on uploads the target already knows to be FULL_OBJECT, and 7e079ff checks the type only when the request carries one. Replication creates a COMPOSITE upload and never sends the type, so neither path is reached. For the same reason, upgrading only the target does not help: the fix has to be on the source.
Forwarding x-amz-checksum-type: FULL_OBJECT in the object-level headers when the checksum is multipart, a mergeable CRC and of type FULL_OBJECT fixes both cases. The target creates a FULL_OBJECT upload and accepts the completion, and the copy takes the single-PUT shortcut. Part headers, single-part objects and COMPOSITE checksums keep the headers they get today. I have a patch with tests and will open a PR.
Steps to Reproduce (for bugs)
Two single-drive servers on one host, mc and aws CLI v2:
export MINIO_CI_CD=1 MINIO_ROOT_USER=admin MINIO_ROOT_PASSWORD=admin12345
D=$(mktemp -d) && cd "$D"
silo server s1 --address :9101 --console-address :9102 >s1.log 2>&1 &
silo server s2 --address :9103 --console-address :9104 >s2.log 2>&1 &
sleep 5
mc alias set s1 http://127.0.0.1:9101 admin admin12345
mc alias set s2 http://127.0.0.1:9103 admin admin12345
mc admin replicate add s1 s2
mc mb s1/repro
export AWS_ACCESS_KEY_ID=admin AWS_SECRET_ACCESS_KEY=admin12345 AWS_DEFAULT_REGION=us-east-1
export AWS_REQUEST_CHECKSUM_CALCULATION=when_required # send only the checksums given below
s3() { aws --endpoint-url http://127.0.0.1:9101 s3api "$@"; }
crc32() { python3 -c 'import base64,sys,zlib; d=b"".join(open(f,"rb").read() for f in sys.argv[1:]); print(base64.b64encode(zlib.crc32(d).to_bytes(4,"big")).decode())' "$@"; }
head -c 5242880 /dev/urandom >p1; head -c 5242880 /dev/urandom >p2
uid=$(s3 create-multipart-upload --bucket repro --key obj --checksum-algorithm CRC32 \
--checksum-type FULL_OBJECT --query UploadId --output text)
e1=$(s3 upload-part --bucket repro --key obj --upload-id "$uid" --part-number 1 --body p1 \
--checksum-crc32 "$(crc32 p1)" --query ETag --output text)
e2=$(s3 upload-part --bucket repro --key obj --upload-id "$uid" --part-number 2 --body p2 \
--checksum-crc32 "$(crc32 p2)" --query ETag --output text)
s3 complete-multipart-upload --bucket repro --key obj --upload-id "$uid" \
--multipart-upload "{\"Parts\":[{\"PartNumber\":1,\"ETag\":$e1,\"ChecksumCRC32\":\"$(crc32 p1)\"},{\"PartNumber\":2,\"ETag\":$e2,\"ChecksumCRC32\":\"$(crc32 p2)\"}]}" \
--checksum-crc32 "$(crc32 p1 p2)" --checksum-type FULL_OBJECT
sleep 5
mc stat s1/repro/obj | grep 'Replication Status' # FAILED
mc ls s2/repro # empty, the object is not on s2
grep -m1 'unable to replicate' s1.logThe completion returns "ChecksumType": "FULL_OBJECT". Then mc stat prints Replication Status: FAILED, mc ls s2/repro prints nothing, and s1.log has the error above. For the copy case, run s3 copy-object --bucket repro --key obj-copy --copy-source repro/obj; mc stat s1/repro/obj-copy also ends at FAILED.
The target behaviour can be seen on one server. create-multipart-upload --checksum-algorithm CRC32 without --checksum-type, which is what replication sends, returns ChecksumType: COMPOSITE. Completing that upload with the whole-object CRC32 fails with BadDigest. With --checksum-type FULL_OBJECT on the create call, the same completion succeeds.
Context
Since c859041 (#31), SILO accepts FULL_OBJECT CRC32 multipart uploads from SDK clients such as boto3. These objects are stored and read fine on the source, but they never reach the other site. Site replication uses the regular bucket replication path (replicateObject), so bucket replication rules should be affected in the same way; I only tested site replication.
Regression
Yes. Upstream minio#21535 (4ea6f3b06) changed getCRCMeta to skip x-amz-checksum-type. Before it, the type was forwarded with every checksum.
Your Environment
- Version used (
silo --version):mainatb91e1c6f2, built from source; both sites run the same build - Server setup and configuration: two single-node, single-drive servers on one host, site replication set up with
mc admin replicate add - Operating System and version (
uname -a): macOS (Darwin 27.0.0, arm64); aws-cli 2.38.4, mc RELEASE.2025-07-21T05-28-08Z
Activity
Merge pull request #255: preserve FULL_OBJECT checksum type in replic…