-
Notifications
You must be signed in to change notification settings - Fork 54
*: clean up low-risk lint issues #5049
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,12 +17,11 @@ import ( | |
| "time" | ||
|
|
||
| "github.com/cenkalti/backoff/v4" | ||
| "github.com/pingcap/errors" | ||
| "github.com/pingcap/log" | ||
| "github.com/pingcap/ticdc/heartbeatpb" | ||
| "github.com/pingcap/ticdc/pkg/common" | ||
| "github.com/pingcap/ticdc/pkg/config" | ||
| cerrors "github.com/pingcap/ticdc/pkg/errors" | ||
| "github.com/pingcap/ticdc/pkg/errors" | ||
| "go.uber.org/atomic" | ||
| "go.uber.org/zap" | ||
| ) | ||
|
|
@@ -182,13 +181,13 @@ func (m *Backoff) StartFinished() { | |
|
|
||
| // ShouldFailChangefeed return true if a running error contains a changefeed not retry error. | ||
| func ShouldFailChangefeed(e *heartbeatpb.RunningError) bool { | ||
| return cerrors.ShouldFailChangefeed(errors.New(e.Message + e.Code)) | ||
| return errors.ShouldFailChangefeed(errors.New(e.Message + e.Code)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Search for RunningError construction sites to verify Message/Code format.
# Find where RunningError structs are created
rg -nP --type=go -C3 'RunningError\s*\{' -g '!vendor/'
# Find where RunningError.Message or RunningError.Code are assigned
rg -nP --type=go -C3 '\.(Message|Code)\s*=' -g '!vendor/' -g '*heartbeatpb*'Repository: pingcap/ticdc Length of output: 20200 🏁 Script executed: # Read the backoff.go file around line 184 to see the full function context
cat -n coordinator/changefeed/backoff.go | sed -n '170,200p'Repository: pingcap/ticdc Length of output: 1186 🏁 Script executed: # Check the RunningError struct definition in protobuf
rg -n --type=go 'type RunningError struct' -A 10Repository: pingcap/ticdc Length of output: 2413 🏁 Script executed: # Look for other usages of ShouldFailChangefeed to understand expected error message format
rg -n --type=go 'ShouldFailChangefeed' -B 3 -A 3Repository: pingcap/ticdc Length of output: 4109 🏁 Script executed: # Check how e.Message is populated in the backoff code
rg -n --type=go 'e\.Message' coordinator/changefeed/backoff.go -B 2 -A 2Repository: pingcap/ticdc Length of output: 304 🏁 Script executed: # Check how ShouldFailChangefeed in errors package actually works
cat -n pkg/errors/helper.go | sed -n '129,160p'Repository: pingcap/ticdc Length of output: 1053 🏁 Script executed: # Check how ErrorCode function extracts the code from errors
rg -n --type=go 'func ErrorCode' -A 8Repository: pingcap/ticdc Length of output: 563 🏁 Script executed: # Look for RFC or error code related helper functions
rg -n --type=go 'RFCErrorCode' -B 2 -A 5Repository: pingcap/ticdc Length of output: 3918 🏁 Script executed: # Check what the ShouldFailChangefeed function at line 130 in helper.go actually checks
rg -n --type=go 'strings.Contains' pkg/errors/helper.go -B 2 -A 2Repository: pingcap/ticdc Length of output: 446 🏁 Script executed: # Look for test cases that show how ShouldFailChangefeed is expected to work
cat -n pkg/errors/error_test.go | sed -n '23,100p'Repository: pingcap/ticdc Length of output: 3023 🏁 Script executed: # Check the changefeedUnRetryableErrors list to understand what it contains
rg -n --type=go 'changefeedUnRetryableErrors' pkg/errors/helper.go -B 5 -A 5Repository: pingcap/ticdc Length of output: 1177 🏁 Script executed: # Check if there are any other examples of how Message and Code are used together
rg -n --type=go 'Message.*Code' coordinator/changefeed/ -A 2 -B 2Repository: pingcap/ticdc Length of output: 474 🏁 Script executed: # Look at how the error is supposed to be formatted by checking the comment or intent
rg -n --type=go 'RunningError' coordinator/changefeed/backoff.go -B 5 -A 5Repository: pingcap/ticdc Length of output: 1780 🏁 Script executed: # Check if there's any documentation about how the Code field is structured
rg -n --type=go 'RFC.*Code\|error.*code' pkg/errors/helper.go | head -20Repository: pingcap/ticdc Length of output: 39 🏁 Script executed: # Look at actual test cases to see what format is expected for e.Code and e.Message
cat -n coordinator/changefeed/backoff_test.go | sed -n '35,70p'Repository: pingcap/ticdc Length of output: 1308 🏁 Script executed: # Check if there are any examples showing both Code and Message populated together
rg -n --type=go 'Code:.*Message:' coordinator/changefeed/ -B 1 -A 1Repository: pingcap/ticdc Length of output: 280 🏁 Script executed: # Look for any formatter or helper that should be used for RunningError
rg -n --type=go 'func.*RunningError.*String\|func.*Format' -A 5Repository: pingcap/ticdc Length of output: 39 Fix error message formatting by adding separator and correcting order. The concatenation 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| func (m *Backoff) HandleError(errs []*heartbeatpb.RunningError) (bool, *heartbeatpb.RunningError) { | ||
| // if there are a fastFail error in errs, we can just fastFail the changefeed | ||
| for _, err := range errs { | ||
| if cerrors.IsChangefeedGCFastFailErrorCode(errors.RFCErrorCode(err.Code)) || | ||
| if errors.IsChangefeedGCFastFailErrorCode(errors.RFCErrorCode(err.Code)) || | ||
| ShouldFailChangefeed(err) { | ||
| return true, err | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.