Skip to content

Conversation

@overtrue
Copy link
Collaborator

@overtrue overtrue commented Oct 8, 2025

Problem

Issue #625 reported an error when uploading 5GB files via multipart upload:

complete_multipart_upload etag err Some("\"2c7ab85a893283e98c931e9511add182\"""), part_id=1

This was caused by PR #592, which introduced the format_etag() function to ensure HTTP responses comply with RFC 7232 (ETags wrapped in quotes). However, this created a mismatch:

  • UploadPart response now returns quoted ETag: "2c7ab85a893283e98c931e9511add182"
  • Client submits this quoted ETag in CompleteMultipartUpload request
  • Internal storage keeps unquoted ETag: 2c7ab85a893283e98c931e9511add182
  • String comparison fails: "etag"etag

Solution

Normalize ETags by removing quotes before comparison using trim_etag() function in three critical locations:

  1. CompleteMultipartUpload (set_disk.rs:6601-6610): Normalize client-submitted and stored ETags before comparison
  2. Replication logic (replication_resyncer.rs:2315-2329): Normalize internal and external S3 API ETags
  3. Transition logic (set_disk.rs:5671-5678): Normalize transition options and stored ETags

Testing

  • ✅ Added unit tests for trim_etag() function
  • ✅ All linter checks pass
  • ✅ ecstore crate compiles
  • ✅ Full workspace compiles

Verification Commands

cargo test --package rustfs-utils --features path -- test_trim_etag
cargo check --workspace

Fixes #625

- Normalize ETags by removing quotes before comparison in complete_multipart_upload
- Fix ETag comparison in replication logic to handle quoted ETags from API responses
- Fix ETag comparison in transition object logic
- Add unit tests for trim_etag function

This fixes the ETag mismatch error when uploading large files (5GB+) via multipart upload,
which was caused by PR #592 adding quotes to ETag responses while internal storage remains unquoted.

Fixes #625
@overtrue overtrue self-assigned this Oct 8, 2025
@loverustfs loverustfs merged commit 007d9c0 into main Oct 8, 2025
14 checks passed
@loverustfs loverustfs deleted the feat/fix-etag-comparison-issue-625 branch October 8, 2025 13:20
@overtrue overtrue mentioned this pull request Oct 15, 2025
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when uploading a 5GB file

2 participants