Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 Cache: Use multipart upload instead of CopyObject for touching file > 5GB #5266

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

bpaquet
Copy link
Contributor

@bpaquet bpaquet commented Aug 20, 2024

Fix #4885

Tested locally with this Dockerfile

FROM python:3.11

RUN pip install torch

ARG x
RUN echo $x

And with the touch_refresh option set to 10s.

@bpaquet bpaquet changed the title Fix #4885: S3 Cache: Use multipart upload instead of CopyObject for touching file > 2GB S3 Cache: Use multipart upload instead of CopyObject for touching file > 2GB Aug 20, 2024
@bpaquet bpaquet changed the title S3 Cache: Use multipart upload instead of CopyObject for touching file > 2GB S3 Cache: Use multipart upload instead of CopyObject for touching file > 5GB Aug 20, 2024
@bpaquet bpaquet force-pushed the fix_4885 branch 3 times, most recently from b713f47 to 74289cf Compare August 20, 2024 15:41
currentPosition += maxCopyObjectSize
}

CompleteMultipartUploadInput := &s3.CompleteMultipartUploadInput{
Copy link
Member

Choose a reason for hiding this comment

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

nit: local variable should be lowercase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Parts: completedParts,
},
}
_, completeErr := s3Client.CompleteMultipartUpload(ctx, CompleteMultipartUploadInput)
Copy link
Member

Choose a reason for hiding this comment

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

just if err := s3Client.Comp.. would do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Key: &key,
UploadId: output.UploadId,
}
_, errAbort := s3Client.AbortMultipartUpload(ctx, &abortIn)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be in defer with a err != nil condition. Eg. let's say context gets canceled while CompleteMultipartUpload is issued.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Key: &key,
UploadId: output.UploadId,
}
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

This requires err to be named return value as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@tonistiigi tonistiigi merged commit 5677f67 into moby:master Aug 22, 2024
91 checks passed
@crazy-max crazy-max added this to the v0.16.0 milestone Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S3 touch fails on files greater than 5GB in size
3 participants