Skip to content

Fix calculation of multipart S3 upload chunk size (continues #1648)#2091

Open
MarcusSorealheis wants to merge 1 commit intoTraceMachina:mainfrom
MarcusSorealheis:s3_fix
Open

Fix calculation of multipart S3 upload chunk size (continues #1648)#2091
MarcusSorealheis wants to merge 1 commit intoTraceMachina:mainfrom
MarcusSorealheis:s3_fix

Conversation

@MarcusSorealheis
Copy link
Collaborator

@MarcusSorealheis MarcusSorealheis commented Dec 11, 2025

Description

  • Add check for maximum file size
  • Calculate minimum chunk size (maximum chunk count) for multipart S3 file upload, checking for proper limit of chunk count before upload
  • Make MAX_UPLOAD_PARTS u64 for uniformity and simplicity

Fixes: #1425
Continues: #1648

Type of change

Please delete options that aren't relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Testing it now.

Checklist

  • Updated documentation if needed
  • Tests added/amended
  • bazel test //... passes locally
  • PR is contained in a single commit, using git amend see some docs

This change is Reviewable

- Add check for maximum file size
- Calculate minimum chunk size (maximum chunk count) for multipart S3
  file upload, checking for proper limit of chunk count before upload
- Make MAX_UPLOAD_PARTS u64 for uniformity and simplicity

Co-authored-by: Marcus <marcuseagan@gmail.com>
@MarcusSorealheis MarcusSorealheis changed the title Fix calculation of multipart S3 upload chunk size Fix calculation of multipart S3 upload chunk size (continues #1648) Dec 11, 2025
Copy link
Member

@palfrey palfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor issue. Although, TBH if anyone's trying to upload 5TB objects in one go, problems will probably get hit anyways, let alone the 48.8TB ones!


// S3 object cannot be larger than this number. See:
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html
const MAX_UPLOAD_SIZE: u64 = 5 * 1024 * 1024 * 1024 * 1024; // 5TB.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That page details the max part size as 48.8 TiB

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.

S3 Store's bytes per upload part calculation logic doesn't make sense

3 participants