Skip to content

Commit

Permalink
joberror: add ConnectionReset/ConnectionRefused to retryable err allo…
Browse files Browse the repository at this point in the history
…w list

Bulk jobs will no longer treat `sysutil.IsErrConnectionReset`
and `sysutil.IsErrConnectionRefused` as permanent errors. IMPORT,
RESTORE and BACKUP will treat this error as transient and retry.

Release note: None
  • Loading branch information
adityamaru committed Apr 29, 2022
1 parent 2951494 commit 5033bb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions pkg/jobs/joberror/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ go_library(
"//pkg/sql/flowinfra",
"//pkg/util/circuit",
"//pkg/util/grpcutil",
"//pkg/util/sysutil",
"@com_github_cockroachdb_errors//:errors",
],
)
11 changes: 7 additions & 4 deletions pkg/jobs/joberror/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/flowinfra"
"github.com/cockroachdb/cockroach/pkg/util/circuit"
"github.com/cockroachdb/cockroach/pkg/util/grpcutil"
"github.com/cockroachdb/cockroach/pkg/util/sysutil"
"github.com/cockroachdb/errors"
)

Expand Down Expand Up @@ -45,9 +46,9 @@ func isBreakerOpenError(err error) bool {
}

// IsPermanentBulkJobError returns true if the error results in a permanent
// failure of a bulk job (IMPORT, BACKUP, RESTORE). This function is a allowlist
// instead of a blocklist: only known safe errors are confirmed to not be
// permanent errors. Anything unknown is assumed to be permanent.
// failure of a bulk job (IMPORT, BACKUP, RESTORE). This function is an
// allowlist instead of a blocklist: only known safe errors are confirmed to not
// be permanent errors. Anything unknown is assumed to be permanent.
func IsPermanentBulkJobError(err error) bool {
if err == nil {
return false
Expand All @@ -57,5 +58,7 @@ func IsPermanentBulkJobError(err error) bool {
!grpcutil.IsClosedConnection(err) &&
!flowinfra.IsNoInboundStreamConnectionError(err) &&
!kvcoord.IsSendError(err) &&
!isBreakerOpenError(err)
!isBreakerOpenError(err) &&
!sysutil.IsErrConnectionReset(err) &&
!sysutil.IsErrConnectionRefused(err)
}

0 comments on commit 5033bb4

Please sign in to comment.