Skip to content

Commit

Permalink
Retry custom request
Browse files Browse the repository at this point in the history
  • Loading branch information
nakulkar-msft committed Jul 14, 2023
1 parent c78f86c commit 6e758e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package common

const AzcopyVersion = "10.19.0"
const AzcopyVersion = "10.19.0-preview"
const UserAgent = "AzCopy/" + AzcopyVersion
const S3ImportUserAgent = "S3Import " + UserAgent
const GCPImportUserAgent = "GCPImport " + UserAgent
Expand Down
9 changes: 9 additions & 0 deletions ste/xferRetrypolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"os"
"strconv"
"time"

Expand Down Expand Up @@ -60,6 +61,8 @@ type XferRetryOptions struct {
// NOTE: Before setting this field, make sure you understand the issues around reading stale & potentially-inconsistent
// data at this webpage: https://docs.microsoft.com/en-us/azure/storage/common/storage-designing-ha-apps-with-ragrs
RetryReadsFromSecondaryHost string // Comment this our for non-Blob SDKs

RetryHTTPErrorConflict bool
}

func (o XferRetryOptions) retryReadsFromSecondaryHost() string {
Expand Down Expand Up @@ -220,6 +223,12 @@ func NewBFSXferRetryPolicyFactory(o XferRetryOptions) pipeline.Factory {
switch {
case err == nil:
action = "NoRetry: successful HTTP request" // no error
case response.Response() != nil && response.Response().StatusCode == http.StatusConflict:
if o.RetryHTTPErrorConflict && os.Getenv("AZCOPY_DISABLE_CUSTOM_RETRY") == "" {
action = "Retry: Custom request"
} else {
action = "NoRetry"
}

case !tryingPrimary && response != nil && response.Response() != nil && response.Response().StatusCode == http.StatusNotFound:
// If attempt was against the secondary & it returned a StatusNotFound (404), then
Expand Down

0 comments on commit 6e758e1

Please sign in to comment.