Skip to content

Support multipart for lakectl presigned uploads#9283

Merged
itaigilo merged 5 commits into
masterfrom
fix/lakectl-presign-upload-multipart
Jul 11, 2025
Merged

Support multipart for lakectl presigned uploads#9283
itaigilo merged 5 commits into
masterfrom
fix/lakectl-presign-upload-multipart

Conversation

@itaigilo

Copy link
Copy Markdown
Contributor

Closes #9015.

Change Description

Background

When using lakectl local, uploading with pre-signed doesn't utilizes multipart uploads for large files.

Bug Fix

Root cause

Very technical issue:
The fileWrapper defined in progress.go doesn't implement a ReadAt() func, hence doesn't implement io.ReaderAt.
Since presignUpload.Upload() requires io.ReaderAt for pre-signed, it checks if the fileWrapper (initialized at SyncManager.upload()) satisfies this, and since it doesn't, it doesn't use multipart for the upload flow.

Solution

Implement ReadAt() for fileWrapper, so that SyncManager.upload() ends up using multipart if needed.

Testing Details

Tested manually:
With or without pre-signed, and with or without multipart.

@itaigilo
itaigilo requested review from a team and N-o-Z July 11, 2025 15:25
@itaigilo itaigilo added include-changelog PR description should be included in next release changelog lakectl-local labels Jul 11, 2025
@itaigilo

Copy link
Copy Markdown
Contributor Author

Also closes product#791.

@N-o-Z N-o-Z left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's very neat how everything comes together.
Please see my comment - it's a very quick fix.
In Addition - I think a clarification is required in upload.go:147
We don't really check if content implements ReaderAt but rather we pass a nil value which is then evaluated when determining whether to use multipart upload or not. I would revise that comment

Comment thread pkg/local/progress.go Outdated
Comment on lines +136 to +138
file io.Seeker
reader io.Reader
readerAt io.ReaderAt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's no need for another field.
Define a new interface called readerSeeker that implements both io.Seeker and io.Reader and then use that type for the file parameter.

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.

Cool. Done.

@itaigilo

Copy link
Copy Markdown
Contributor Author

Thanks @N-o-Z for the review.

I've also updated the comment (L:147) - it's confusing indeed.
It might be simplified, but I prefer to keep this change minimal for now.

PTAL again 🙏

@itaigilo
itaigilo requested a review from N-o-Z July 11, 2025 18:34

@N-o-Z N-o-Z left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM,
Please open an issue to test this scenario in esti - lets make sure we do perform MPU on files > 5G

@itaigilo
itaigilo merged commit a5a7aff into master Jul 11, 2025
41 checks passed
@itaigilo
itaigilo deleted the fix/lakectl-presign-upload-multipart branch July 11, 2025 19:14
@itaigilo

Copy link
Copy Markdown
Contributor Author

Added an Issue for Esti,
Following @N-o-Z 's request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

include-changelog PR description should be included in next release changelog lakectl-local

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lakectl error when uploading files larger than 5 GB recursively

2 participants