-
Notifications
You must be signed in to change notification settings - Fork 354
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
lakectl presign large presigned download using multipart #7284
Conversation
682c23d
to
1fd645e
Compare
♻️ PR Preview 0974161 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
) | ||
|
||
const ( | ||
DefaultDownloadPartSize int64 = 1024 * 1024 * 8 // 8MB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nopcoder Don't you think we should add some way for the user to control it?
We can add another task for it if you don't think we should do it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the concurrency can also be controlled by the user like we do in other APIs/commands.
You can open another issue for it if you prefer to do that in another PR
// fallback to download if missing size | ||
if statResp.JSON200 == nil || statResp.JSON200.SizeBytes == nil { | ||
return d.downloadObject(ctx, src, dst) | ||
} | ||
|
||
// check if the object is small enough to download in one request | ||
sizeBytes := *statResp.JSON200.SizeBytes | ||
if sizeBytes < d.PartSize { | ||
return d.downloadObject(ctx, src, dst) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// fallback to download if missing size | |
if statResp.JSON200 == nil || statResp.JSON200.SizeBytes == nil { | |
return d.downloadObject(ctx, src, dst) | |
} | |
// check if the object is small enough to download in one request | |
sizeBytes := *statResp.JSON200.SizeBytes | |
if sizeBytes < d.PartSize { | |
return d.downloadObject(ctx, src, dst) | |
} | |
// fallback to download if missing size | |
if statResp.JSON200 == nil || statResp.JSON200.SizeBytes == nil || *statResp.JSON200.SizeBytes < d.PartSize { | |
return d.downloadObject(ctx, src, dst) | |
} |
And maybe add a log to indicate why we fallback to download
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Don't think I need to log this decision
- Kept the two
if
to make the code clear
const ( | ||
MinDownloadPartSize int64 = 1024 * 64 // 64KB | ||
DefaultDownloadPartSize int64 = 1024 * 1024 * 8 // 8MB | ||
DefaultDownloadConcurrency = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that one can be controlled by the user as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently supports only single large file download using presign.
Close #7283