Repository navigation
fix: preserve metadata and checksums in federated object copies - #157
Merged
Merged
Conversation
The legacy etcd federation branch of CopyObjectHandler forwards the copied source metadata to the remote deployment with minio-go Core.PutObject, after removing only two reserved keys (compression and actual-size). Every small object is stored inline, so its stored metadata also carries X-Minio-Internal-inline-data; the remote's setRequestLimitMiddleware rejects any request bearing a reserved-prefix header (containsReservedMetadata), so the forwarded write failed with 400 InvalidArgument "Your metadata headers are not supported." for the default COPY metadata directive. A plain federated PutObject must not carry any internal storage metadata, so strip the whole reserved-prefix class before forwarding instead of an enumerated subset. Enumerating a third key would only defer the next leak: besides inline-data, replication bookkeeping (replica/replication status and timestamps) is added to the same map earlier in the handler and would be rejected just the same. None of these keys is required by the remote for a correct plain PutObject; they are internal storage details the remote sets for itself. The stripping uses stringsHasPrefixFold, matching the remote's own case-insensitive detection. Ordinary user metadata (x-amz-meta-*) is untouched and still copied. The pre-existing UUID ETag on the federated write (no Content-MD5 is sent) is out of scope and left unchanged, as recorded in the issue. A new end-to-end test drives the real federation branch through getRemoteInstanceClient and minio-go into a second in-process deployment, copying an inline source with the default COPY directive. It asserts the copy now succeeds, that no reserved-prefix header reaches the remote on any forwarded request, and that copied user metadata survives. Fixes #100 Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7qJqWwy8oFA6aCXWRzXQe Signed-off-by: Feng Ruohang <[email protected]>
The legacy etcd federation branch of CopyObjectHandler forwards the copied bytes with minio-go Core.PutObject but never asked the remote for a checksum and discarded any it returned, so a cross-deployment whole-object copy that requested a checksum returned 200 with an empty checksum, and a checksum-less source did not gain the S3 default CRC-64NVME that the local path assigns. The request was neither honored nor rejected. This is the whole-object counterpart of #72, which repaired the same class of defect for federated UploadPartCopy. When a server-side checksum is wanted -- explicitly requested, inherited from a multipart source, or the CRC-64NVME default for a checksum-less object, all already captured in dstOpts.WantServerSideChecksumType -- the forwarded PutObject now streams a trailing checksum of that type, so the remote computes and persists it and echoes it in the response. The value the remote reports for that exact write is bound into objInfo.Checksum, matching how the local CopyObject path carries checksums into the CopyObjectResult. Reading the value from the same UploadInfo that produced the ETag keeps the pair bound to one write. Only the requested algorithm is returned; a malformed or absent remote value leaves objInfo.Checksum unset, so an ordinary copy that wanted no checksum still returns none. Two small mapping helpers convert between the server's hash.ChecksumType and the minio-go request type and response field. New end-to-end tests drive the real federation branch through getRemoteInstanceClient and minio-go into a second in-process deployment and assert that CRC32/CRC32C/SHA256/CRC64NVME and the no-algorithm default are all returned in the CopyObjectResult and persisted on the destination, and that a requested algorithm never leaks other algorithms into the response. Fixes #99 Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7qJqWwy8oFA6aCXWRzXQe Signed-off-by: Feng Ruohang <[email protected]>
…ated-copy-merge-20260908 Signed-off-by: Feng Ruohang <[email protected]>
Signed-off-by: Feng Ruohang <[email protected]>
Vonng
marked this pull request as ready for review
September 8, 2026 05:07
pull Bot
pushed a commit
to ShinnChow/silo
that referenced
this pull request
Sep 8, 2026
…w-ups) Three residual checksum defects in the legacy etcd federation branch of CopyObjectHandler, found by post-merge review of pgsty#157. 1. Empty-source 500 regression. A checksum-less object gains the S3 default CRC-64NVME (WantServerSideChecksumType is set), but minio-go streams no trailing checksum for a 0-byte body (contentLength == 0), so the remote computed none, federatedChecksumValue was empty, hash.NewChecksumWithType returned nil, and the handler returned 500 -- so every empty-object federated copy failed. For a 0-byte source, forward the empty-content digest as an ordinary checksum request header instead, so the remote validates, persists and returns it, matching the local path (e.g. CRC32 "AAAAAA=="). 2. Inherited full-object checksum dropped. When the source already carries a full-object checksum, the local path sets dstOpts.WantChecksum, not WantServerSideChecksumType (only multipart-composite sources are promoted). The federated branch inspected only WantServerSideChecksumType, so a checksum-bearing source's checksum was silently discarded on a federated copy that requested no algorithm. Forward WantChecksum.Encoded (always a plain digest) as a checksum header so the remote validates and persists it, and bind the returned value, matching local persistence. 3. Multipart-suffixed remote value accepted. The bind accepted a value like "NSRBwg==-0": NewChecksumWithType parses the "-N" as ChecksumMultipart with WantParts 0 and the length-only validator passes, so the destination was returned as COMPOSITE. A single forwarded PutObject must yield a full-object digest, so reject a multipart-marked parsed value in addition to the existing nil (missing/malformed) rejection. A forwarded checksum request header is stripped from objInfo.UserDefined so it is not mistaken for object metadata. Out of scope: the SSE federated-copy corruption (srcInfo.Reader/Size mismatch for encrypted sources) predates this work and is filed separately. New federated regressions cover empty source with requested and default checksum (200 + correct value + persisted), an inherited full-object checksum preserved without a requested algorithm, and a multipart-suffixed remote value rejected. Red/green verified for each against the merged code. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Feng Ruohang <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Legacy etcd federation sends internal storage metadata when copying an inline object, causing the remote write to fail, and ignores requested CopyObject checksums. Filter the reserved metadata prefix while retaining user metadata, request the selected checksum on the remote PUT, and return the checksum associated with that write.
The original local commits are retained on current main. End-to-end handler tests cover inline objects, user metadata, all five requested algorithms and the default checksum. Focused handler tests pass with
-race; full SILO CI and vulnerability checks run on this candidate.Merge review also reproduced success responses with no checksum when the remote returned a missing, invalid-base64 or wrong-length checksum. These now fail with HTTP 500 instead of acknowledging an incomplete checksum contract. The regression fails on the initial candidate and passes with the correction. As with other remote-write response failures, the destination may already contain the object; the handler does not attempt a destructive rollback.
This affects legacy bucket federation; ordinary local copies retain their current behavior. The maintained SILO stack is tested; compatibility with unmodified upstream MinIO remains best effort.
Contributed under AGPL-3.0-or-later with DCO sign-offs and original authorship retained.
Fixes #99.
Fixes #100.