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

[TM DownloadFile Pause and Resume] Part 2: Implement pause for downloadFile operation #3094

Merged

Conversation

zoewangg
Copy link
Contributor

@zoewangg zoewangg commented Mar 14, 2022

Motivation and Context

This is the part 2 of the implementation to support pause and resume for downloadFile operation
This PR will be merged to a feature branch once approved.

Modifications

This is still in draft. Add support for pause for downloadFile operation

Testing

Added unit tests and integ tests

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

Comment on lines 31 to 32
public final class PersistableFileDownload implements PersistableTransfer,
ToCopyableBuilder<PersistableFileDownload.Builder, PersistableFileDownload> {
Copy link
Contributor

Choose a reason for hiding this comment

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

How can users serialize this to, e.g., a disk or database?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think they can use any serialization/deserialization library to do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we should consider the option of vending an opaque (Base32 or Base64) string/token that can be used to resume a download.

@@ -204,6 +205,8 @@ private Context() {
*/
TransferObjectRequest request();

SdkResponse initialResponse();
Copy link
Contributor

Choose a reason for hiding this comment

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

Javadoc!

Also, can this be a S3Response?

private final long bytesTransferred;
private final Instant lastModified;

private PersistableFileDownload(DefaultBuilder builder) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we should include a (perhaps optional) checksum of the bytes written so far, which a resume would validate before appending to an existing file. This would help ensure we don't clobber a file if it was modified by another source.

@zoewangg zoewangg changed the base branch from master to zoewang/tm-download-pause-resume March 17, 2022 02:09
@zoewangg zoewangg marked this pull request as ready for review March 22, 2022 17:01
@zoewangg zoewangg requested a review from a team as a code owner March 22, 2022 17:01
@zoewangg zoewangg changed the title [TM DownloadFile Pause and Resume] Part 1: Implement pause for downloadFile operation [TM DownloadFile Pause and Resume] Part 2: Implement pause for downloadFile operation Mar 29, 2022
@zoewangg zoewangg force-pushed the zoewang/downloadPauseResume branch from 3a576e2 to 9a4a68e Compare March 30, 2022 00:41
@sonarcloud
Copy link

sonarcloud bot commented Mar 30, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

77.7% 77.7% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@dagnir dagnir left a comment

Choose a reason for hiding this comment

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

:shipit:

@zoewangg zoewangg merged commit c1d55ac into zoewang/tm-download-pause-resume Mar 31, 2022
zoewangg added a commit that referenced this pull request Apr 27, 2022
* [TM DownloadFile Pause and Resume] Part 1: Add configuration to enable overwriting existing files (#3125)

* Expose an option to overwrite an existing file in FileAsyncResponseTransformer

* Add changelog entries and make TM use CREATE_OR_REPLACE_EXISTING write option by default

* Address feedback

* Update and address feedback

* [TM DownloadFile Pause and Resume] Part 2: Implement pause for downloadFile operation (#3094)

* Part 1: Implement pause for downloadFile operation

* Address feedback

* Refactor the logic

* Address feedback

* Fix merging issue

* [TM DownloadFile Pause and Resume] Part 3: Implement resumeDownloadFile (#3157)

* Implement resumeDownloadFile

* Move test code around

* Address feedback

* Fix flaky test

* fix flaky integ test

* add changelog entry

* Troubleshooting flaky test

* Add file length check when checking if file has modified or not

* Address feedback
@zoewangg zoewangg deleted the zoewang/downloadPauseResume branch May 16, 2022 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants