-
Notifications
You must be signed in to change notification settings - Fork 2k
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
ShareFileClient.DownloadToFile Removing Retry.max(3) #43093
base: main
Are you sure you want to change the base?
Conversation
API change check API changes are not detected in this pull request. |
.../test-shared/java/com/azure/storage/common/test/shared/policy/MockPartialResponsePolicy.java
Outdated
Show resolved
Hide resolved
@Override | ||
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { | ||
return next.process().flatMap(response -> { | ||
HttpHeader rangeHttpHeader = response.getRequest().getHeaders().get(RANGE_HEADER); |
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.
Are we always guaranteed for consumers of this to use x-ms-range
as the range header? If not, in the future when needed this could be modified to include a header in the constructor to determine which header to look for.
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.
Looks good! I just had some minor suggestions on refactoring the tests that got added.
...torage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java
Outdated
Show resolved
Hide resolved
...torage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java
Show resolved
Hide resolved
.../test-shared/java/com/azure/storage/common/test/shared/policy/MockPartialResponsePolicy.java
Outdated
Show resolved
Hide resolved
.../test-shared/java/com/azure/storage/common/test/shared/policy/MockPartialResponsePolicy.java
Outdated
Show resolved
Hide resolved
...torage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java
Outdated
Show resolved
Hide resolved
...zure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java
Show resolved
Hide resolved
...e/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java
Outdated
Show resolved
Hide resolved
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.
Looks good. Just had a couple more comments and we should be set here.
@@ -7,6 +7,7 @@ | |||
### Breaking Changes | |||
|
|||
### Bugs Fixed | |||
- `ShareFileClient.downloadToFile()` now retries for a maximum of 5 times when the download fails due to a network error. |
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.
Let's also include what the previous maximum (15) and note both that the number of reties was unintentional and that the additional retires past the intended maximum of 5 could lead to writing in incorrect positions in the file.
...torage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java
Outdated
Show resolved
Hide resolved
// Assert that the range headers that were retried match what was returned from MockPartialResponsePolicy | ||
List<String> expectedRanges = expectedHeaderRanges(); | ||
List<String> actualRanges = policy.getRangeHeaders(); | ||
assertEquals(expectedRanges.size(), actualRanges.size()); |
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.
We should be able to remove the size assertion here and defer to the direct equals assertion of the two lists for these test cases so just:
assertEquals(expectedRanges, actualRanges);
List<String> expectedRanges = expectedHeaderRanges(); | ||
List<String> actualRanges = policy.getRangeHeaders(); | ||
assertEquals(expectedRanges.size(), actualRanges.size()); | ||
|
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 we forgot to add the assertEquals
here for the two lists
Description
Removing extra outer retries in downloadToFile as this was causing a mismatch in bytes downloaded when inner retries from downloadWithResponse's FluxUtil.createRetriableDownloadFlux were exhausted.