Skip to content

Commit 765f1fe

Browse files
D3HunterGMHDBJD
authored andcommitted
objstore: retry on GCS EOF error (pingcap#59851)
close pingcap#59754
1 parent 6b6b149 commit 765f1fe

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

br/pkg/storage/gcs.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
goerrors "errors"
99
"fmt"
1010
"io"
11+
"net/url"
1112
"os"
1213
"path"
1314
"strings"
@@ -474,6 +475,14 @@ func shouldRetry(err error) bool {
474475
}
475476
}
476477

478+
// workaround for https://github.com/googleapis/google-cloud-go/issues/7090
479+
// seems it's a bug of golang net/http: https://github.com/golang/go/issues/53472
480+
if e := (&url.Error{}); goerrors.As(err, &e) {
481+
if goerrors.Is(e.Err, io.EOF) {
482+
return true
483+
}
484+
}
485+
477486
errMsg := err.Error()
478487
// workaround for strange unknown errors
479488
retryableErrMsg := []string{

br/pkg/storage/gcs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,6 @@ func TestSpeedReadManyFiles(t *testing.T) {
574574
}
575575

576576
func TestGCSShouldRetry(t *testing.T) {
577-
require.True(t, shouldRetry(&url.Error{Err: goerrors.New("http2: server sent GOAWAY and closed the connectiont"), Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"}))
578577
require.True(t, shouldRetry(&url.Error{Err: goerrors.New("http2: client connection lost"), Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"}))
578+
require.True(t, shouldRetry(&url.Error{Err: io.EOF, Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"}))
579579
}

0 commit comments

Comments
 (0)