Skip to content

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

Merged
tonistiigi merged 1 commit intomoby:masterfrom
bpaquet:fix_4885
Aug 22, 2024
Merged

S3 Cache: Use multipart upload instead of CopyObject for touching file > 5GB#5266
tonistiigi merged 1 commit intomoby:masterfrom
bpaquet:fix_4885

Conversation

@bpaquet
Copy link
Copy Markdown
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
Comment thread cache/remotecache/s3/s3.go Outdated
currentPosition += maxCopyObjectSize
}

CompleteMultipartUploadInput := &s3.CompleteMultipartUploadInput{
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread cache/remotecache/s3/s3.go Outdated
Parts: completedParts,
},
}
_, completeErr := s3Client.CompleteMultipartUpload(ctx, CompleteMultipartUploadInput)
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread cache/remotecache/s3/s3.go Outdated
Key: &key,
UploadId: output.UploadId,
}
_, errAbort := s3Client.AbortMultipartUpload(ctx, &abortIn)
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

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