Skip to content

files_external amazons3: cross-mount MOVE should use server-side MultipartCopy when peer is same S3 endpoint #62645

Description

@TobyTheHutt

Tip

Help move this idea forward

  • Use the 👍 reaction to show support for this feature.
  • Avoid commenting unless you have relevant information to add; unnecessary comments create noise for subscribers.
  • Subscribe to receive notifications about status changes and new comments.

Is your feature request related to a problem? Please describe.

\OC\Files\Storage\Common::copyFromStorage routes every cross-mount MOVE through PHP. When both mounts are files_external amazons3 on the same S3 endpoint, the source is read via fopen('r') and re-uploaded via \Aws\S3\MultipartUploader. The uploader's non-seekable branch materialises each part into php://temp before dispatch, so every part transits local temp storage. Temp usage scales with object size.

If the destination rejects a part, \Aws\Multipart\AbstractUploadManager::getResultHandler records the error and continues yielding parts. Temp usage grows unbounded.

Describe the solution you'd like

Add a fast path in Common::moveFromStorage (or an \OCA\Files_External\Lib\Storage\AmazonS3::copyFromStorage override). When source and destination are both AmazonS3 on the same endpoint, dispatch \Aws\S3\MultipartCopy (server-side UploadPartCopy with x-amz-copy-source).

Bytes stay on the S3 side. No PHP staging. Wall-clock reduces to seconds regardless of object size.

Precondition: the destination tenant's principal must hold s3:GetObject on the source bucket.

Describe alternatives you've considered

  • Lower uploadPartSize and concurrency on the mount. Shrinks per-part footprint. Keeps O(N) buffering.
  • Bucket-side LifecycleConfiguration AbortIncompleteMultipartUpload. Cleans up after the fact. Unsupported by NetApp StorageGrid.
  • Out-of-band aws s3 copy. Bypasses Nextcloud. oc_filecache stays stale.
  • perf(ObjectStoreStorage): Improve (slow) move on same object bucket #47986 (merged, NC 31). Same-bucket fast path inside ObjectStoreStorage. Cross-mount files_external remains uncovered.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapenhancement

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions