Support UploadPartCopy (multipart server-side copy): AWS CLI and boto3 use it for any copy over 8 MB

Aperta
#168 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
aws, rust
Ambito
api, backend, cloud

Direzione di ricerca

Start with build_copy_object in crates/core/src/api/request.rs and the existing execute_copy and UploadPart paths to trace parsing, authorization, dispatch, and signing. Then read the copy header forwarding and multipart tests, and update the unsupported notes in docs/reference/operations.md and docs/reference/errors.md. Done means same endpoint UploadPartCopy works through multipart completion with and without a source range, source access is authorized, cross endpoint copies remain rejected, and the requested tests pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

What's needed

Support S3 UploadPartCopy: a PUT that carries x-amz-copy-source together with uploadId and partNumber. It copies a byte range of an existing object into a part of an in-progress multipart upload. CopyObject (#119, #121) works today. UploadPartCopy is still rejected with 501 NotImplemented.

Why it matters sooner than expected

The deferral note in crates/core/src/api/request.rs (build_copy_object) assumes UploadPartCopy is only needed for objects over the 5 GB single-request CopyObject limit:

// ponytail: UploadPartCopy deferred — same copy-source mechanism, but
// it targets an in-progress multipart upload. Add when a client needs
// server-side copy of objects larger than the 5 GB single-copy limit.

Standard clients use it far below that size. The AWS CLI (aws s3 cp / aws s3 mv / aws s3 sync between two S3 URLs) and boto3's managed copy() switch to a multipart copy (CreateMultipartUpload → UploadPartCopy × N → CompleteMultipartUpload) once the object exceeds multipart_threshold, which defaults to 8 MB. obstore/object_store and rclone also use multipart copy above their thresholds. So any copy or rename of an object over about 8 MB fails, while smaller objects copy fine. Users see that as "copy works for some files and not others".

From Source Cooperative's production proxy (data.source.coop) in the past week, two unrelated clients hit this:

  • One was reorganising a dataset with server-side copies. .parquet files tens of MB in size failed with not implemented: server-side multipart copy (UploadPartCopy) is not supported, status=501, while their small files copied fine.
  • The other was copying a single GeoTIFF; its UploadPartCopy request (PUT …?partNumber=1&uploadId=…) failed the same way.

Some clients then fall back to a download-and-reupload, or leave behind an orphaned multipart upload (the CreateMultipartUpload succeeded before the part copy failed).

Current behaviour

  • build_copy_object in crates/core/src/api/request.rs returns ProxyError::NotImplemented when the copy-source PUT has an uploadId query parameter.
  • That rejection is asserted by a test in the same file ("UploadPartCopy must be NotImplemented").
  • It is documented as unsupported in docs/reference/operations.md and docs/reference/errors.md.

Proposed approach

Most of the machinery already exists from CopyObject and multipart UploadPart:

  • Add an UploadPartCopy { bucket, key, upload_id, part_number, src_bucket, src_key, src_version } operation to S3Operation. Parse it in build_copy_object instead of rejecting, reusing parse_copy_source and validate_key.
  • Authorize it like CopyObject: the caller must be able to read the source (including its version) and write the destination. That covers the copy-source mapping via RequestInfo::with_copy_source and the path-mapping / OIDC fixes from #128 and #129.
  • Dispatch it like execute_copy. Use the same-endpoint check and build_copy_source_header, and build the backend URL as for UploadPart (?partNumber=&uploadId=). Sign it with sign_s3_request, and forward x-amz-copy-source-range plus the x-amz-copy-source-if-* headers through is_copy_forward_header.
  • The response is a small CopyPartResult XML (ETag, LastModified) that can pass through unchanged. As with CopyObject, a 200 response can still carry an embedded <Error>; detect it the same way.
  • Cross-endpoint part copies stay 501, matching CopyObject.
  • Tests: a part copy round-trip (Create → UploadPartCopy with and without x-amz-copy-source-range → Complete), an authorization denial on the source, and a cross-endpoint rejection. Update the docs to match.

Acceptance

aws s3 cp s3://<bucket>/<key-larger-than-8MB> s3://<bucket>/<new-key> --endpoint-url <proxy> succeeds, and so does boto3 client.copy(...) on the same object.

Lingua principale
Rust
Stelle
21
Fork
1
Merge medio
16h 39m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di developmentseed/multistore

Tutte le issue di developmentseed/multistore

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.