*: move redo s3 check from cli to server#4281
*: move redo s3 check from cli to server#4281Debra-He wants to merge 2 commits intopingcap:masterfrom
Conversation
|
Hi @Debra-He. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Welcome @Debra-He! |
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughCLI changefeed creation now exposes an option to skip redo storage I/O checks and delegates full storage connectivity/initialization validation to the server; ReplicaConfig and Consistent/redo validation paths were extended to accept an enable-IO-check flag. Tests added for the new behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as "CLI"
participant Server as "TiCDC Server"
participant Storage as "External Storage (S3 / FS)"
CLI->>Server: create changefeed + replica config (EnableConsistentStorageIOCheck=false)
Server->>Storage: validate/init external storage (I/O checks)
alt storage reachable and valid
Storage-->>Server: success
Server-->>CLI: changefeed created (ack)
else storage unreachable or invalid
Storage-->>Server: error
Server-->>CLI: create failed (error)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @Debra-He, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the validation process for redo log external storage configurations, moving the check from the client-side command-line interface to the TiCDC server. This change addresses potential issues in deployment environments where the CLI might not have direct network access to external storage services like S3, ensuring that such validations occur in the appropriate server context during changefeed initialization. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request moves the redo log S3 connectivity check from the CLI to the TiCDC server. This is achieved by removing the call to ReplicaConfig.ValidateAndAdjust in the CLI's changefeed creation logic. While this correctly prevents the CLI from performing network checks it might not be able to, it also disables all other client-side configuration validations, which could degrade user experience by delaying error feedback. I've added a comment suggesting a more targeted refactoring to address this.
cmd/cdc/cli/cli_changefeed_create.go
Outdated
| // NOTE: Do not call cfg.ValidateAndAdjust here. | ||
| // It may try to initialize redo external storage (for example, S3) and perform a connectivity | ||
| // check locally, which breaks environments where only TiCDC server nodes can access S3. | ||
| // The server will validate and adjust the replica config during changefeed initialization. |
There was a problem hiding this comment.
Removing the call to cfg.ValidateAndAdjust disables all client-side validation for the replica configuration, not just the redo log storage check that performs network I/O. This means other configuration errors (e.g., in sink settings, scheduler, etc.) will only be detected by the server, leading to slower feedback for the user. A more targeted approach would be to refactor ValidateAndAdjust to allow skipping only the network-intensive storage checks. This would maintain the benefits of client-side validation for other parameters.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmd/cdc/cli/cli_changefeed_create.go`:
- Around line 154-156: The url.Parse error returned from the check on
o.commonChangefeedOptions.sinkURI should be wrapped before returning to preserve
stack context; replace `if _, err :=
url.Parse(o.commonChangefeedOptions.sinkURI); err != nil { return err }` with a
wrapped error using Go error wrapping (e.g. `return fmt.Errorf("invalid sink URI
%q: %w", o.commonChangefeedOptions.sinkURI, err)`), and add the fmt import if
missing so the function (in cli_changefeed_create.go) returns the wrapped error.
cmd/cdc/cli/cli_changefeed_create.go
Outdated
| if _, err := url.Parse(o.commonChangefeedOptions.sinkURI); err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the actual code at lines 154-160 in the file
cat -n cmd/cdc/cli/cli_changefeed_create.go | sed -n '150,165p'Repository: pingcap/ticdc
Length of output: 752
🏁 Script executed:
#!/bin/bash
# Also check the imports to see if errors package is available
head -50 cmd/cdc/cli/cli_changefeed_create.go | grep -E "^import|github.com/pingcap/errors"Repository: pingcap/ticdc
Length of output: 94
Wrap url.Parse error before returning.
Library errors require stack trace wrapping per guidelines.
Suggested fix
if _, err := url.Parse(o.commonChangefeedOptions.sinkURI); err != nil {
- return err
+ return errors.Trace(err)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if _, err := url.Parse(o.commonChangefeedOptions.sinkURI); err != nil { | |
| return err | |
| } | |
| if _, err := url.Parse(o.commonChangefeedOptions.sinkURI); err != nil { | |
| return errors.Trace(err) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@cmd/cdc/cli/cli_changefeed_create.go` around lines 154 - 156, The url.Parse
error returned from the check on o.commonChangefeedOptions.sinkURI should be
wrapped before returning to preserve stack context; replace `if _, err :=
url.Parse(o.commonChangefeedOptions.sinkURI); err != nil { return err }` with a
wrapped error using Go error wrapping (e.g. `return fmt.Errorf("invalid sink URI
%q: %w", o.commonChangefeedOptions.sinkURI, err)`), and add the fmt import if
missing so the function (in cli_changefeed_create.go) returns the wrapped error.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: close #4122
What is changed and how it works?
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note
Summary by CodeRabbit
New Features
Bug Fixes
Tests