-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jobs,sql/importer: retry circuit breaker open errors
We would like to retry circuit breaker open errors. In fact, jobs.IsPermanentBulkJobError already looks like it would return false for breaker open errors. But, there are actually two circuit breaker packages we use: github.com/cockroachdb/circuitbreaker github.com/cockroachdb/cockroach/pkg/util/circuit Both define ErrBreakerOpen. IsPermanentBulkJobError would only catch errors from one of these packages. Now, we test for both. As a result, ErrBreakerOpen errors emerging from the nodedialer will now be retried. Fixes #89159 Fixes #85111 Fixes #81353 I may be being a bit optimistic that this will fully fixe those failures. Success of the job still requires that the retry of the job is successful. Release note (bug fix): Fix bug that resulted in some retriable errors not being retried during IMPORT.
- Loading branch information
1 parent
2e4606c
commit 2561370
Showing
8 changed files
with
158 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package joberror | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
circuitbreaker "github.com/cockroachdb/circuitbreaker" | ||
"github.com/cockroachdb/cockroach/pkg/util/circuit" | ||
"github.com/cockroachdb/errors" | ||
"github.com/cockroachdb/redact" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestErrBreakerOpenIsRetriable(t *testing.T) { | ||
br := circuit.NewBreaker(circuit.Options{ | ||
Name: redact.Sprint("Breaker"), | ||
AsyncProbe: func(_ func(error), done func()) { | ||
done() // never untrip | ||
}, | ||
EventHandler: &circuit.EventLogger{Log: func(redact.StringBuilder) {}}, | ||
}) | ||
br.Report(errors.New("test error")) | ||
utilBreakderErr := br.Signal().Err() | ||
// NB: This matches the error that dial produces. | ||
dialErr := errors.Wrapf(circuitbreaker.ErrBreakerOpen, "unable to dial n%d", 9) | ||
|
||
for _, e := range []error{ | ||
utilBreakderErr, | ||
dialErr, | ||
} { | ||
t.Run(fmt.Sprintf("%s", e), func(t *testing.T) { | ||
require.False(t, IsPermanentBulkJobError(e)) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters