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

br: avoid retry if it's ec2metadata (#47651) #47790

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions br/pkg/storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,12 +969,21 @@
r.Error = errors.New("read tcp *.*.*.*:*->*.*.*.*:*: read: connection reset by peer")
}
})
if r.HTTPRequest.URL.Host == ec2MetaAddress && (isDeadlineExceedError(r.Error) || isConnectionResetError(r.Error)) {
// fast fail for unreachable linklocal address in EC2 containers.
log.Warn("failed to get EC2 metadata. skipping.", logutil.ShortError(r.Error))
return false
}
if isConnectionResetError(r.Error) {
return true
}
<<<<<<< HEAD

Check failure on line 980 in br/pkg/storage/s3.go

View workflow job for this annotation

GitHub Actions / integration-test (8.0.22)

syntax error: unexpected <<, expected }

Check failure on line 980 in br/pkg/storage/s3.go

View workflow job for this annotation

GitHub Actions / integration-test (8.0.26)

syntax error: unexpected <<, expected }
if isDeadlineExceedError(r.Error) && r.HTTPRequest.URL.Host == ec2MetaAddress {
// fast fail for unreachable linklocal address in EC2 containers.
log.Warn("failed to get EC2 metadata. skipping.", logutil.ShortError(r.Error))
=======
if isConnectionRefusedError(r.Error) {
>>>>>>> f4a139ffe34 (br: avoid retry if it's ec2metadata (#47651))

Check failure on line 986 in br/pkg/storage/s3.go

View workflow job for this annotation

GitHub Actions / integration-test (8.0.22)

newline in rune literal

Check failure on line 986 in br/pkg/storage/s3.go

View workflow job for this annotation

GitHub Actions / integration-test (8.0.26)

newline in rune literal
return false
}
return rl.DefaultRetryer.ShouldRetry(r)
Expand Down
4 changes: 4 additions & 0 deletions br/tests/br_full/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ test_log="${TEST_DIR}/${DB}_test.log"
error_str="not read from or written to within the timeout period"
unset BR_LOG_TO_TERM

<<<<<<< HEAD
export GO_FAILPOINTS="github.com/pingcap/tidb/br/pkg/backup/backup-storage-error=1*return(\"connection refused\")->1*return(\"InternalError\");github.com/pingcap/tidb/br/pkg/backup/backup-timeout-error=1*return(\"<Code>RequestTimeout</Code>\")->1*return(\"not read from or written to within the timeout period\")"
=======
export GO_FAILPOINTS="github.com/pingcap/tidb/br/pkg/backup/backup-storage-error=1*return(\"connection refused\")->1*return(\"InternalError\");github.com/pingcap/tidb/br/pkg/backup/backup-timeout-error=1*return(\"<Code>RequestTimeout</Code>\")->1*return(\"not read from or written to within the timeout period\")->1*return(\"<Code>InvalidPart</Code>\")"
>>>>>>> f4a139ffe34 (br: avoid retry if it's ec2metadata (#47651))
run_br --pd $PD_ADDR backup full -s "local://$TEST_DIR/$DB-lz4" --concurrency 4 --compression lz4 --log-file $test_log
export GO_FAILPOINTS=""
size_lz4=$(du -d 0 $TEST_DIR/$DB-lz4 | awk '{print $1}')
Expand Down
Loading