Skip to content

Commit 39fdecb

Browse files
joechenrhti-chi-bot
authored andcommitted
This is an automated cherry-pick of pingcap#60144
Signed-off-by: ti-chi-bot <[email protected]>
1 parent d109bf0 commit 39fdecb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

br/pkg/storage/gcs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,12 @@ func shouldRetry(err error) bool {
514514
retryableErrMsg := []string{
515515
"http2: client connection force closed via ClientConn.Close",
516516
"broken pipe",
517+
<<<<<<< HEAD
518+
=======
519+
"http2: client connection lost",
520+
// See https://stackoverflow.com/questions/45209168/http2-server-sent-goaway-and-closed-the-connection-laststreamid-1999 for details.
521+
"http2: server sent GOAWAY",
522+
>>>>>>> ddfd52a8151 (objstore: retry on "server sent GOAWAY" http2 error (#60144))
517523
}
518524

519525
for _, msg := range retryableErrMsg {

br/pkg/storage/gcs_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ func TestSpeedReadManyFiles(t *testing.T) {
573573
t.Logf("read %d large files cost %v", len(testFiles), time.Since(now))
574574
}
575575

576+
<<<<<<< HEAD
576577
func TestCtxUsage(t *testing.T) {
577578
httpSvr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
578579
defer httpSvr.Close()
@@ -598,4 +599,10 @@ func TestCtxUsage(t *testing.T) {
598599
_, err = stg.FileExists(ctx, "key")
599600
// before the fix, it's context canceled error
600601
require.ErrorContains(t, err, "invalid_request")
602+
=======
603+
func TestGCSShouldRetry(t *testing.T) {
604+
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/"}))
605+
require.True(t, shouldRetry(&url.Error{Err: goerrors.New("http2: client connection lost"), Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"}))
606+
require.True(t, shouldRetry(&url.Error{Err: io.EOF, Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"}))
607+
>>>>>>> ddfd52a8151 (objstore: retry on "server sent GOAWAY" http2 error (#60144))
601608
}

0 commit comments

Comments
 (0)