Skip to content

*: move redo s3 check from cli to server#4281

Open
Debra-He wants to merge 2 commits intopingcap:masterfrom
Debra-He:fix/move-redo-s3-check-from-cli-to-server
Open

*: move redo s3 check from cli to server#4281
Debra-He wants to merge 2 commits intopingcap:masterfrom
Debra-He:fix/move-redo-s3-check-from-cli-to-server

Conversation

@Debra-He
Copy link

@Debra-He Debra-He commented Feb 26, 2026

What problem does this PR solve?

Issue Number: close #4122

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

Summary by CodeRabbit

  • New Features

    • Storage validation is now configurable so CLI can skip remote storage I/O checks when appropriate (e.g., certain sinks).
  • Bug Fixes

    • Changefeed creation no longer fails due to local external-storage I/O checks; other config validations remain enforced.
  • Tests

    • Added coverage ensuring skip-IO-check behavior and that non-IO config errors are still reported.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. labels Feb 26, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 26, 2026

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@ti-chi-bot ti-chi-bot bot added the needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. label Feb 26, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 26, 2026

Welcome @Debra-He!

It looks like this is your first PR to pingcap/ticdc 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/ticdc. 😃

@pingcap-cla-assistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a306be8 and 6d0c53b.

📒 Files selected for processing (6)
  • cmd/cdc/cli/cli_changefeed_create.go
  • cmd/cdc/cli/cli_changefeed_create_test.go
  • pkg/config/consistent.go
  • pkg/config/replica_config.go
  • pkg/redo/config.go
  • pkg/redo/config_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/cdc/cli/cli_changefeed_create_test.go
  • cmd/cdc/cli/cli_changefeed_create.go

📝 Walkthrough

Walkthrough

CLI 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

Cohort / File(s) Summary
CLI changefeed create
cmd/cdc/cli/cli_changefeed_create.go
Call to ValidateAndAdjust replaced with ValidateAndAdjustWithOptions(..., ReplicaConfigValidateAndAdjustOptions{EnableConsistentStorageIOCheck: false}) so CLI can skip consistent storage I/O checks.
CLI tests
cmd/cdc/cli/cli_changefeed_create_test.go
Added tests TestCompleteReplicaCfgSkipConsistentStorageIOCheckInCLI and TestCompleteReplicaCfgStillValidateReplicaConfigInCLI to verify skipping IO check while still validating other replica config fields.
Replica config API
pkg/config/replica_config.go
Added ReplicaConfigValidateAndAdjustOptions and ValidateAndAdjustWithOptions; ValidateAndAdjust delegates to the new method with IO check enabled by default.
Consistent validation helper
pkg/config/consistent.go
Added internal validateAndAdjust(enableIOCheck bool) helper and wired calls to accept the enable-IO-check flag.
Redo storage validation (pkg/redo)
pkg/redo/config.go, pkg/redo/config_test.go
Added StorageValidationOptions{EnableIOCheck bool} and ValidateStorageWithOptions to allow skipping I/O checks; existing ValidateStorage delegates to the new function. Added test TestValidateStorageWithOptionsSkipIOCheck.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped the CLI, left checks for the server,

nibbling configs while leaving I/O to the observer.
Skip a check, keep the rest — steady and spry,
the redo logs hum as the servers reply. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely describes the main change: moving S3 connectivity check from CLI to server, matching the PR's primary objective.
Description check ✅ Passed The PR description includes the required issue number (close #4122) and most template sections, though the 'What is changed and how it works?' section is empty.
Linked Issues check ✅ Passed The code changes implement the objective to move S3 connectivity validation from CLI to server by introducing configurable options to skip storage I/O checks in CLI and validate on server.
Out of Scope Changes check ✅ Passed All changes are directly related to moving S3 connectivity checks from CLI to server: new options for controlling I/O validation, tests for new functionality, and CLI logic updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • Redo Log S3 Validation Relocation: The responsibility for validating and adjusting redo log external storage configurations (like S3) has been shifted from the cdc cli to the TiCDC server. This change prevents local connectivity checks that could fail in environments where the CLI lacks direct access to the storage.
  • Enhanced Test Coverage: A new unit test was introduced to specifically verify that the CLI's completeReplicaCfg function no longer performs local validation of redo storage, ensuring the intended behavior is maintained.

🧠 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
  • cmd/cdc/cli/cli_changefeed_create.go
    • Removed the ValidateAndAdjust call for replica configuration, specifically for redo external storage, from the CLI's completeReplicaCfg function.
  • cmd/cdc/cli/cli_changefeed_create_test.go
    • Introduced a new test case TestCompleteReplicaCfgDoesNotValidateRedoStorage to confirm that the CLI no longer attempts to validate redo storage locally.
Activity
  • No human activity has occurred on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 26, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +157 to +160
// 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5129f10 and a306be8.

📒 Files selected for processing (2)
  • cmd/cdc/cli/cli_changefeed_create.go
  • cmd/cdc/cli/cli_changefeed_create_test.go

Comment on lines 154 to 156
if _, err := url.Parse(o.commonChangefeedOptions.sinkURI); err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 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.

Suggested change
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.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign flowbehappy for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move S3 connectivity check from cdc cli to cdc server when creating changefeeds with redo log

1 participant