Skip to content

tests: support cloud-engine next gen startup - #4661

Merged
ti-chi-bot[bot] merged 3 commits into
pingcap:masterfrom
tenfyzhong:zhongtenghui/nextgen-cloud-engine-cdc-enable
Apr 1, 2026
Merged

ti-chi-bot[bot] merged 3 commits into
pingcap:masterfrom
tenfyzhong:zhongtenghui/nextgen-cloud-engine-cdc-enable

Conversation

@tenfyzhong

@tenfyzhong tenfyzhong commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #4660

What is changed and how it works?

This PR updates next-gen integration test cluster startup scripts to support TiKV binaries built from the cloud-engine branch.

Before generating the TiKV config, the scripts now run tikv-server -V and parse Git Commit Branch. When the branch is cloud-engine, the scripts append:

[cdc]
enable = true

The non-TLS next-gen startup only applies this to upstream-tikv.toml, while the TLS next-gen startup applies it to its generated TiKV config.

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Manual verification:

  • bash -n tests/integration_tests/_utils/start_tidb_cluster_nextgen tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen

Questions

Will it cause performance regression or break compatibility?

No. The change only affects next-gen integration test startup scripts and only appends cdc.enable = true when tikv-server -V reports Git Commit Branch: cloud-engine.

Do you need to update user documentation, design documentation or monitoring documentation?

No.

Release note

None

Summary by CodeRabbit

  • Tests
    • Detect TiKV build/version earlier during test cluster startup and surface its details.
    • Always enable change data capture (CDC) in generated TiKV configurations for upstream and downstream nodes.
    • Removed redundant TiKV version checks to streamline startup and configuration generation.

Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Mar 31, 2026
@coderabbitai

coderabbitai Bot commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 11513240-81aa-41d9-a71e-19a5b11a0377

📥 Commits

Reviewing files that changed from the base of the PR and between 2f92bb1 and ec18b35.

📒 Files selected for processing (2)
  • tests/integration_tests/_utils/start_tidb_cluster_nextgen
  • tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen
  • tests/integration_tests/_utils/start_tidb_cluster_nextgen

📝 Walkthrough

Walkthrough

Two next-gen integration test startup scripts now run tikv-server -V, parse the Git Commit Branch, and when it equals cloud-engine they set a flag to append [cdc]\nenable = true into generated TiKV config files before starting TiKV; redundant late tikv-server --version calls were removed.

Changes

Cohort / File(s) Summary
Next-gen TiKV startup scripts
tests/integration_tests/_utils/start_tidb_cluster_nextgen, tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen
Invoke tikv-server -V early and print version output; parse Git Commit Branch and set tikvNeedsCdcEnable when branch == cloud-engine; conditionally append [cdc]\nenable = true to generated TiKV TOML files; remove later standalone tikv-server --version calls.

Sequence Diagram(s)

sequenceDiagram
    participant Script
    participant TiKV_Binary
    participant Config_File
    Script->>TiKV_Binary: run `tikv-server -V`
    TiKV_Binary-->>Script: version output (includes Git Commit Branch)
    Script->>Script: parse branch, set tikvNeedsCdcEnable
    alt branch == cloud-engine
        Script->>Config_File: append [cdc]\nenable = true
    else
        Script->>Config_File: write standard TiKV config
    end
    Script->>TiKV_Binary: start TiKV with generated config
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size/XS

Suggested reviewers

  • wk989898
  • hongyunyan

Poem

🐰 I checked the TiKV note and found a clue,
If "cloud-engine" hops in, CDC's turned true.
I nudged the config with a happy little twitch,
Then watched the cluster boot up without a glitch. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'tests: support cloud-engine next gen startup' clearly describes the main change: adding support for cloud-engine branch in next-gen test startup scripts.
Description check ✅ Passed The PR description provides sufficient detail including problem statement (issue #4660), what changed, manual testing steps, and answers to compatibility/documentation questions.
Linked Issues check ✅ Passed The PR implementation matches issue #4660 requirements: it detects TiKV branch via tikv-server -V, parses Git Commit Branch, and appends [cdc] with enable = true to TiKV configs as specified.
Out of Scope Changes check ✅ Passed All changes are scoped to next-gen integration test startup scripts and directly support the stated objective of handling cloud-engine branch TiKV binaries.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@ti-chi-bot ti-chi-bot Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 31, 2026

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

Copy link
Copy Markdown

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 introduces logic to automatically enable CDC in TiKV configurations when the 'cloud-engine' branch is detected during integration tests. This change is implemented in both the standard and TLS cluster startup scripts, while also removing redundant version print statements. The review feedback highlights an opportunity to refactor the duplicated version-checking logic into a shared utility and suggests applying the CDC configuration to downstream TiKV instances as well to ensure consistency across the test environment.

Comment on lines +99 to +105
tikvVersionInfo=$(tikv-server -V 2>&1)
printf '%s\n' "$tikvVersionInfo"
tikvGitCommitBranch=$(printf '%s\n' "$tikvVersionInfo" | sed -nE 's/^Git Commit Branch:[[:space:]]*([^[:space:]]+).*$/\1/p' | head -n 1)
tikvNeedsCdcEnable=false
if [ "$tikvGitCommitBranch" = "cloud-engine" ]; then
tikvNeedsCdcEnable=true
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The logic for detecting the TiKV branch and determining if CDC needs to be enabled is duplicated in tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen. To improve maintainability and ensure consistency across different test startup scripts, consider extracting this logic into a shared function or a common utility script.

Comment on lines +233 to +238
if [ "$tikvNeedsCdcEnable" = "true" ]; then
cat >>"$OUT_DIR/upstream-tikv.toml" <<EOF
[cdc]
enable = true
EOF
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The cdc.enable = true configuration is only applied to upstream-tikv.toml. In these integration tests, both upstream and downstream clusters typically use the same TiKV binary. If the cloud-engine branch requires this configuration for proper operation, it should likely be applied to downstream-tikv.toml as well (after it is initialized around line 240) to ensure the downstream cluster starts and behaves correctly.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@tenfyzhong PTAL. I think BDR mode needs this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The comment is outdated. I have added the same configuration to the downstream config file on line 263.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen (1)

71-78: Implementation is consistent with the non-TLS script.

The version check logic is identical to start_tidb_cluster_nextgen, which is good for consistency.

Consider extracting to a shared helper function.

Both nextgen scripts now have identical logic for checking the TiKV version and determining if CDC should be enabled. Consider extracting this into a reusable function in a shared utility file (e.g., test_prepare or a new helper) to reduce duplication:

# Example helper function
get_tikv_needs_cdc_enable() {
    local tikvVersionInfo
    tikvVersionInfo=$(tikv-server -V 2>&1)
    printf '%s\n' "$tikvVersionInfo"
    local tikvGitCommitBranch
    tikvGitCommitBranch=$(printf '%s\n' "$tikvVersionInfo" | sed -nE 's/^Git Commit Branch:[[:space:]]*([^[:space:]]+).*$/\1/p' | head -n 1)
    if [ "$tikvGitCommitBranch" = "cloud-engine" ]; then
        echo "true"
    else
        echo "false"
    fi
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen` around
lines 71 - 78, Extract the duplicated TiKV version / CDC detection logic into a
shared helper function (suggested name get_tikv_needs_cdc_enable) and replace
the inline block in start_tls_tidb_cluster_impl_nextgen and
start_tidb_cluster_nextgen with a call to that helper; the helper should run
tikv-server -V, print the version info as before, parse the "Git Commit Branch"
using the existing sed expression, and output "true" or "false" so callers can
assign tikvNeedsCdcEnable=$(get_tikv_needs_cdc_enable) — add the helper to a
common test utility file (e.g., test_prepare or a new shared helper) and update
both scripts to source that file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen`:
- Around line 71-78: Extract the duplicated TiKV version / CDC detection logic
into a shared helper function (suggested name get_tikv_needs_cdc_enable) and
replace the inline block in start_tls_tidb_cluster_impl_nextgen and
start_tidb_cluster_nextgen with a call to that helper; the helper should run
tikv-server -V, print the version info as before, parse the "Git Commit Branch"
using the existing sed expression, and output "true" or "false" so callers can
assign tikvNeedsCdcEnable=$(get_tikv_needs_cdc_enable) — add the helper to a
common test utility file (e.g., test_prepare or a new shared helper) and update
both scripts to source that file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 10bdb03a-08eb-4a0a-bf15-48f475ba4922

📥 Commits

Reviewing files that changed from the base of the PR and between 8a067c4 and 74e4bc0.

📒 Files selected for processing (2)
  • tests/integration_tests/_utils/start_tidb_cluster_nextgen
  • tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen

Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
@ti-chi-bot ti-chi-bot Bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Mar 31, 2026
@tenfyzhong

Copy link
Copy Markdown
Contributor Author

/test next-gen

@ti-chi-bot

ti-chi-bot Bot commented Apr 1, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wk989898, wlwilliamx

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [wk989898,wlwilliamx]

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 1, 2026
@ti-chi-bot

ti-chi-bot Bot commented Apr 1, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-03-31 11:13:49.44999918 +0000 UTC m=+263634.655359237: ☑️ agreed by wlwilliamx.
  • 2026-04-01 11:23:25.864755661 +0000 UTC m=+350611.070115718: ☑️ agreed by wk989898.

@tenfyzhong

Copy link
Copy Markdown
Contributor Author

/test next-gen

…heck

- Remove branch detection logic for TiKV version
- Always enable CDC in TiKV configuration files
- Simplify TiKV version check to just display output without parsing
- This eliminates conditional logic that was specific to 'cloud-engine' branch

Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
@ti-chi-bot ti-chi-bot Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 1, 2026
@tenfyzhong

Copy link
Copy Markdown
Contributor Author

/test all

@ti-chi-bot

ti-chi-bot Bot commented Apr 1, 2026

Copy link
Copy Markdown

@tenfyzhong: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cdc-pulsar-integration-heavy-next-gen 2f92bb1 link false /test pull-cdc-pulsar-integration-heavy-next-gen
pull-cdc-pulsar-integration-light-next-gen 2f92bb1 link false /test pull-cdc-pulsar-integration-light-next-gen
pull-cdc-mysql-integration-heavy-next-gen 2f92bb1 link false /test pull-cdc-mysql-integration-heavy-next-gen
pull-cdc-kafka-integration-light-next-gen 2f92bb1 link false /test pull-cdc-kafka-integration-light-next-gen
pull-cdc-storage-integration-light-next-gen 2f92bb1 link false /test pull-cdc-storage-integration-light-next-gen
pull-cdc-storage-integration-heavy-next-gen 2f92bb1 link false /test pull-cdc-storage-integration-heavy-next-gen
pull-cdc-kafka-integration-heavy-next-gen 2f92bb1 link false /test pull-cdc-kafka-integration-heavy-next-gen
pull-cdc-mysql-integration-light-next-gen 2f92bb1 link unknown /test pull-cdc-mysql-integration-light-next-gen

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@ti-chi-bot
ti-chi-bot Bot merged commit 0a357c8 into pingcap:master Apr 1, 2026
10 of 12 checks passed
tenfyzhong added a commit that referenced this pull request Apr 1, 2026
@tenfyzhong

Copy link
Copy Markdown
Contributor Author

/cherry-pick release-8.5

@ti-chi-bot

Copy link
Copy Markdown
Member

@tenfyzhong: new pull request created to branch release-8.5: #5804.

Details

In response to this:

/cherry-pick release-8.5

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 ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Support cloud-engine TiKV branches in next-gen CI

4 participants