Skip to content

DNM: Release 6.5.12 Hotfix 20260601#12664

Open
haiboumich wants to merge 3 commits into
pingcap:release-6.5-20250717-v6.5.12from
haiboumich:release-6.5.12-hotfix-20260601
Open

DNM: Release 6.5.12 Hotfix 20260601#12664
haiboumich wants to merge 3 commits into
pingcap:release-6.5-20250717-v6.5.12from
haiboumich:release-6.5.12-hotfix-20260601

Conversation

@haiboumich

Copy link
Copy Markdown

What problem does this PR solve?

Issue Number: close #xxx

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

Trim trailing whitespace and statement delimiters before checking
whether an EXCHANGE PARTITION DDL ends with WITHOUT VALIDATION.

Add test coverage for trailing whitespace, newlines, and semicolon
variants to ensure the rebuilt DDL preserves WITHOUT VALIDATION.
@ti-chi-bot ti-chi-bot Bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jun 1, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

[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 gozssky 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 the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 1, 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 normalizes the DDL query string by trimming trailing whitespace, newlines, and semicolons before checking for the "WITHOUT VALIDATION" suffix in exchange partition actions, and adds comprehensive unit tests for these cases. The review feedback suggests adding defensive checks to prevent potential runtime panics from nil pointers or invalid substring indices.

Comment thread cdc/model/sink.go
Comment on lines 765 to 768
upperQuery := strings.ToUpper(job.Query)
normalizedUpperQuery := strings.TrimRight(upperQuery, " \t\r\n;")
idx1 := strings.Index(upperQuery, "EXCHANGE PARTITION") + len("EXCHANGE PARTITION")
idx2 := strings.Index(upperQuery, "WITH TABLE")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

To prevent potential runtime panics, we should implement defensive programming checks here:

  1. Check if tableInfo or preTableInfo is nil before accessing their fields.
  2. Ensure EXCHANGE PARTITION and WITH TABLE are actually found in the query (i.e., strings.Index does not return -1) and that their relative positions are valid (idx1 <= idx2) before slicing the query string.

If any of these checks fail, we can safely fall back to using the original job.Query.

		if tableInfo == nil || preTableInfo == nil {
			d.Query = job.Query
			break
		}
		upperQuery := strings.ToUpper(job.Query)
		normalizedUpperQuery := strings.TrimRight(upperQuery, " \t\r\n;")
		idx1 := strings.Index(upperQuery, "EXCHANGE PARTITION")
		idx2 := strings.Index(upperQuery, "WITH TABLE")
		if idx1 == -1 || idx2 == -1 || idx1+len("EXCHANGE PARTITION") > idx2 {
			d.Query = job.Query
			break
		}
		idx1 += len("EXCHANGE PARTITION")

@haiboumich

Copy link
Copy Markdown
Author

/test pull-verify

Resolve certificate paths relative to the test file instead of relying
on git repo root discovery.

This change is only to eliminate unrelated CI noise for this hotfix PR.
Do not cherry-pick this commit.
@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 Jun 1, 2026
@haiboumich

Copy link
Copy Markdown
Author

/retest-required

@ti-chi-bot

ti-chi-bot Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@haiboumich: 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-integration-kafka-test 7c45c32 link true /test pull-cdc-integration-kafka-test
pull-cdc-integration-mysql-test 7c45c32 link true /test pull-cdc-integration-mysql-test
pull-dm-integration-test 7c45c32 link true /test pull-dm-integration-test
pull-dm-compatibility-test 7c45c32 link true /test pull-dm-compatibility-test

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.

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

Labels

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.

1 participant