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

feat(bigquery): widen retry predicate #6976

Merged
merged 6 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 10 additions & 2 deletions bigquery/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ func runWithRetryExplicit(ctx context.Context, call func() error, allowedReasons
var (
defaultRetryReasons = []string{"backendError", "rateLimitExceeded"}
jobRetryReasons = []string{"backendError", "rateLimitExceeded", "internalError"}
retry5xxCodes = []int{
http.StatusInternalServerError,
http.StatusBadGateway,
http.StatusServiceUnavailable,
http.StatusGatewayTimeout,
}
)

// This is the correct definition of retryable according to the BigQuery team. It
Expand Down Expand Up @@ -237,8 +243,10 @@ func retryableError(err error, allowedReasons []string) bool {
}
}
}
if e.Code == http.StatusServiceUnavailable || e.Code == http.StatusBadGateway {
return true
for _, code := range retry5xxCodes {
Copy link
Contributor

Choose a reason for hiding this comment

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

The function comment needs to be updated, as it mentions just the 502 and 503 errors - It also considers 502 ("Bad Gateway") and 503 ("Service Unavailable") errors retryable;

if e.Code == code {
return true
}
}
case *url.Error:
retryable := []string{"connection refused", "connection reset"}
Expand Down
2 changes: 1 addition & 1 deletion bigquery/bigquery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestRetryableErrors(t *testing.T) {
&googleapi.Error{
Code: http.StatusInternalServerError,
},
false,
true,
},
{
"internal w/backend reason",
Expand Down