Repository navigation
fix(s3): don't leave a partial file when a download fails - #1328
Open
vedant21-oss wants to merge 1 commit into
Open
vedant21-oss wants to merge 1 commit into
vedant21-oss wants to merge 1 commit into
Conversation
DownloadObject wrote straight to the output path, so a failed download left a partial file that --ignore-existing then skipped, and with --overwrite it replaced the previous file with partial data. Download to a .partial file and rename it into place once the copy succeeds. Fixes kitops-ml#1327 Signed-off-by: vedant21-oss <vedantmalodeofficial@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
DownloadObjectwrote s3 datasets straight to the output path, so a failed download left a partial file behind. that file then got skipped as already existing on--ignore-existing, and with--overwritea failed download wiped the previous good file.this downloads to
<path>.partialfirst and renames it into place once the copy and close succeed. on any error the partial file is removed and the original file (if any) is left alone. the close error is also checked now instead of being ignored.i went with a fixed
.partialname instead ofos.CreateTempso the file keeps the same permissions as before (CreateTempmakes it 0600).added
TestDownloadObjectusing the existing mock client: success, failed download with no existing file, and failed download over an existing file. the two failure cases fail on main.Linked issues
fixes #1327