Skip to content

test(dm): add DDL option regression coverage#12685

Open
GMHDBJD wants to merge 1 commit into
pingcap:masterfrom
GMHDBJD:fix/issue-12429-mariadb-mysql-ddl-options-135043
Open

test(dm): add DDL option regression coverage#12685
GMHDBJD wants to merge 1 commit into
pingcap:masterfrom
GMHDBJD:fix/issue-12429-mariadb-mysql-ddl-options-135043

Conversation

@GMHDBJD

@GMHDBJD GMHDBJD commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #12429

DM should continue to accept upstream CREATE TABLE DDLs that include MariaDB-specific table options such as PAGE_CHECKSUM and TRANSACTIONAL, and MySQL-specific table options such as AUTOEXTEND_SIZE.

On current upstream/master, the reported DDL statements are already accepted by the TiDB parser dependency, so the original parser/schema-tracker failure is not reproducible anymore. This PR adds focused regression coverage in DM to prevent this compatibility behavior from regressing.

What is changed and how it works?

  • Add parser regression coverage for CREATE TABLE statements using:
    • TRANSACTIONAL=0
    • PAGE_CHECKSUM=1 TRANSACTIONAL=0
    • AUTOEXTEND_SIZE=4M
  • Add schema tracker regression coverage for the same DDL patterns and verify the tables/columns are tracked successfully.

Check List

Tests

  • Unit test

Commands run:

go test ./dm/pkg/parser -run TestParserSpecificCreateTableOptions -count=1
go test ./dm/pkg/schema -run TestDDLWithSpecificCreateTableOptions -count=1
go test ./dm/pkg/parser ./dm/pkg/schema -count=1
make fmt
git diff --check

Questions

Will it cause performance regression or break compatibility?

No. This PR only adds regression tests and does not change runtime behavior.

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

No. This PR only adds regression test coverage for existing compatible behavior.

Release note

None

@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jun 9, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jun 9, 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 lance6716 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 area/dm Issues or PRs related to DM. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 9, 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 new unit tests to verify the parsing and tracking of DDLs with specific CREATE TABLE options, such as 'transactional=0', 'PAGE_CHECKSUM=1', and 'AUTOEXTEND_SIZE=4M'. Feedback was provided to address a potential loop variable capture issue in the parallel subtests of 'TestParserSpecificCreateTableOptions' to prevent race conditions in Go versions prior to 1.22.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +391 to +392
for _, sql := range cases {
t.Run(sql, func(t *testing.T) {

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

In Go versions prior to 1.22, referencing the loop variable sql directly inside a parallel subtest (t.Parallel()) causes all subtests to run using the value of the loop variable from the last iteration. To prevent this race condition and ensure all test cases are executed correctly, capture the loop variable sql locally within the loop.

Suggested change
for _, sql := range cases {
t.Run(sql, func(t *testing.T) {
for _, sql := range cases {
sql := sql
t.Run(sql, func(t *testing.T) {

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

Labels

area/dm Issues or PRs related to DM. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DM: MariaDB and MySQL specific DDL options cause failures

1 participant