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

Added error handling when a chuck is not downloaded from an Azure blob #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion zedUpload/azureutil/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,20 @@ func DownloadAzureBlob(accountURL, accountName, accountKey, containerName, remot
if err != nil {
return err
}
body := dr.Body(azblob.RetryReaderOptions{MaxRetryRequests: maxRetries})
var retryErrorStr []string
body := dr.Body(azblob.RetryReaderOptions{
MaxRetryRequests: maxRetries,
NotifyFailedRead: func(failureCount int, lastError error, offset int64, count int64, willRetry bool) {
retryError := fmt.Errorf("total read failures: %d, offset: %d, error: %v", failureCount, offset, lastError)
retryErrorStr = append(retryErrorStr, retryError.Error())
if !willRetry {
err = fmt.Errorf(strings.Join(retryErrorStr, "\n"))
}
},
})
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this if err != nil { is not needed. As I understand it, dr.Body is just constructor and download starts below with io.CopyBuffer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, is this async in some way? I haven't looked at the azure API in quite some time.

Copy link
Author

Choose a reason for hiding this comment

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

I do not know about the whole API, but the way we use it is as follows: We send 16 concurrent requests to download 1MB chunks. When we download all of them, we move to the next 16 chunks until we download the whole file.

return err
}
rangeProgress := int64(0)
body = pipeline.NewResponseBodyProgress(
body,
Expand Down
Loading