fix(mirror): skip recopies when source ETag is preserved in metadata - #351
Merged
Conversation
S3-to-S3 mirror uploads through a temporary file, so multipart completion stores a different ETag than the source. Auto compare now records the source ETag in x-amz-meta-rc-source-etag and HeadObject fills that identity when listed ETags differ, so unchanged objects are skipped on the next run. Co-authored-by: RustFS <hello@rustfs.com>
…pare Auto compare recopies when destination identity is absent or wrong, and size mismatches skip HeadObject. Mark the protected mirror contract with a BREAKING migration note for the additive change. Co-authored-by: RustFS <hello@rustfs.com>
The previous synchronize event ran before the PR body included BREAKING. This empty commit re-runs CI against the updated description. Co-authored-by: RustFS <hello@rustfs.com>
houseme
marked this pull request as ready for review
August 25, 2026 02:37
cxymds
reviewed
Aug 25, 2026
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.
Related issue
Fixes #342
Background
rc mirrorcopies S3-to-S3 objects through a download-then-upload path. Multipart completion on the destination stores a different ETag than the source (hash-2vshash-1in the report). The planner compared ListObjects ETags, so a second--overwriterun recopied every object even when the bytes were unchanged.mc cp --preservekeeps the source ETag via server-side copy. Cross-alias mirror cannot do that, and ListObjects does not return user metadata, so ETag-only planning cannot see a client-recorded identity.Solution
x-amz-meta-rc-source-etag.--compare auto|etag|size(defaultauto):auto: skip when ETags match, or when size matches and destination metadata records the source ETagetag: skip only on identical stored ETagssize: skip when sizes matchautomode, destinations with the same size but a different listed ETag are inspected with HeadObject so the identity metadata can be read.This is additive. Existing flags and default skip-on-matching-ETag behavior are unchanged. Objects copied before this change still recopy once; after that they skip.
This PR must be marked BREAKING because
docs/reference/rc/mirror.mdis a protected CLI behavior contract. The change is additive; no JSON schema or configschema_versionbump applies.Tests
--comparescripts/regression/mirror-identity.shValidation
cargo fmt --all cargo clippy --workspace -- -D warnings cargo test --workspace ./scripts/regression/mirror-identity.sh