Skip to content

DM: Extend MySQL and MariaDB support for newer versions - #12628

Open
dveeden wants to merge 6 commits into
pingcap:masterfrom
dveeden:tagged_gtid
Open

dveeden wants to merge 6 commits into
pingcap:masterfrom
dveeden:tagged_gtid

Conversation

@dveeden

@dveeden dveeden commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Updated go-mysql

What problem does this PR solve?

Issue Number: closes #12629

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

Support for newer versions of MySQL and MariaDB was extended

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-triage-completed release-note Denotes a PR that will be considered when it comes time to generate release notes. area/dm Issues or PRs related to DM. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 7, 2026
@dveeden

dveeden commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

/cc @OliverS929 @D3Hunter

@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 updates the project to Go 1.25.9 and performs a significant upgrade of various dependencies, most notably go-mysql and tidb. The core changes involve refactoring GTID handling to align with the updated go-mysql library, including the transition from UUIDSet to MysqlGTIDSet and structural changes to MariaDB GTID sets. Feedback from the review highlights a potential side-effect in GTID incrementing that should be addressed by working on a copy of the data. Additionally, there are recommendations for improving code maintainability through the use of helper functions for repeated logic, removing redundant assignments, and simplifying loops where variables are unused.

Comment on lines 174 to 180
mariaGTID := singleGTID.(*gmysql.MariadbGTID)
mariaGTID.SequenceNumber++
gtidSet := new(gmysql.MariadbGTIDSet)
gtidSet.Sets = map[uint32]map[uint32]*gmysql.MariadbGTID{
mariaGTID.DomainID: {
mariaGTID.ServerID: mariaGTID,
},
gtidSet.Sets = map[uint32]*gmysql.MariadbGTID{
mariaGTID.DomainID: mariaGTID,
}
clone = gtidSet

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

In the MariaDB flavor case, mariaGTID is a pointer to an element within the original gSet. Modifying mariaGTID.SequenceNumber directly causes a side effect on the input gSet. To ensure GTIDIncrease is pure and doesn't modify its input, you should work on a copy of the GTID struct.

Suggested change
mariaGTID := singleGTID.(*gmysql.MariadbGTID)
mariaGTID.SequenceNumber++
gtidSet := new(gmysql.MariadbGTIDSet)
gtidSet.Sets = map[uint32]map[uint32]*gmysql.MariadbGTID{
mariaGTID.DomainID: {
mariaGTID.ServerID: mariaGTID,
},
gtidSet.Sets = map[uint32]*gmysql.MariadbGTID{
mariaGTID.DomainID: mariaGTID,
}
clone = gtidSet
mariaGTID := *singleGTID.(*gmysql.MariadbGTID)
mariaGTID.SequenceNumber++
gtidSet := new(gmysql.MariadbGTIDSet)
gtidSet.Sets = map[uint32]*gmysql.MariadbGTID{
mariaGTID.DomainID: &mariaGTID,
}
clone = gtidSet

Comment on lines +125 to +130
for u, tags := range *mSet {
sid = u
for _, intervals := range tags {
interval = intervals[0]
}
}

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 extracting the single SID and Interval from a MysqlGTIDSet is repeated here and in newGenerator (in generator.go). Since DM requires these sets to have exactly one entry (as enforced by verifySingleGTID), consider moving this extraction logic into a helper function to improve code reuse and maintainability.

for tag, intervals := range tags {
intervals[0].Start++
intervals[0].Stop++
(*mSet)[u][tag] = intervals

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

This assignment is redundant because intervals is a slice, which is a reference type in Go. Modifying its elements on lines 167-168 already updates the data within the map. Removing this line would clarify that the modification is happening in-place on the cloned set.

Comment on lines +202 to +206
var sid uuid.UUID
var tags map[gmysql.Tag]gmysql.IntervalSlice
for sid, tags = range *mysqlGTIDs {
}
var uuidSet *gmysql.UUIDSet
for _, uuidSet = range mysqlGTIDs.Sets {
_ = sid

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 variable sid is declared and assigned but not used, necessitating a blank assignment _ = sid to satisfy the compiler. This can be simplified by using a blank identifier directly in the range loop.

		var tags map[gmysql.Tag]gmysql.IntervalSlice
		for _, tags = range *mysqlGTIDs {
		}

@dveeden
dveeden force-pushed the tagged_gtid branch 4 times, most recently from 59316e0 to a6afe34 Compare May 7, 2026 12:52
@dveeden

dveeden commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@wuhuizuo wuhuizuo changed the title DM: Extend MySQL and MariaDB support for newer versions DM: Extend MySQL and MariaDB support for newer versions May 8, 2026
@wuhuizuo wuhuizuo changed the title DM: Extend MySQL and MariaDB support for newer versions DM: Extend MySQL and MariaDB support for newer versions May 8, 2026
ti-chi-bot Bot pushed a commit to PingCAP-QE/ci that referenced this pull request May 9, 2026
#4578)

### What

Update TiFlow latest CI images to the newer Go 1.25 image tag:

- `ghcr.io/pingcap-qe/ci/jenkins:v2026.4.12-10-gc29110c-go1.25` for
jenkins job
- `ghcr.io/pingcap-qe/ci/base:v2026.4.12-10-gc29110c-go1.25` for the
Prow unit test job

### Why

TiFlow PR pingcap/tiflow#12628 updates `go.mod` to `go 1.25.9`.
Some CI jobs were still running with older Go 1.25 images, causing
errors like:
```text
compile: version "go1.25.9" does not match go tool version "go1.25.8" 
``` 
### Test result
I have run replay tests for all failed tasks. The Go version mismatch
issue is now fully resolved. The remaining failures are either
integration test failures inherent to the TiFlow PR itself, or runtime
issues on individual Jenkins/K8s agents. These are not directly related
to the current upgrade of the Go image.

---------

Signed-off-by: lyb <yebin.li@pingcap.com>
@wuhuizuo

wuhuizuo commented May 9, 2026

Copy link
Copy Markdown
Contributor

/test pull-verify

@dveeden

dveeden commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@ti-chi-bot ti-chi-bot Bot added the area/engine Issues or PRs related to Dataflow Engine. label May 11, 2026
@dveeden

dveeden commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

/retest

2 similar comments
@dveeden

dveeden commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@dveeden

dveeden commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@dveeden

dveeden commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

/retest pull-verify

@ti-chi-bot

ti-chi-bot Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

@dveeden: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

/test pull-build
/test pull-cdc-integration-kafka-test
/test pull-cdc-integration-mysql-test
/test pull-cdc-integration-pulsar-test
/test pull-cdc-integration-storage-test
/test pull-check
/test pull-dm-compatibility-test
/test pull-dm-integration-test
/test pull-error-log-review
/test pull-syncdiff-integration-test
/test pull-unit-test-cdc
/test pull-verify
/test wip-pull-unit-test-dm
/test wip-pull-unit-test-engine

The following commands are available to trigger optional jobs:

/test pull-dm-integration-test-next-gen

Use /test all to run the following jobs that were automatically triggered:

pingcap/tiflow/ghpr_verify
pingcap/tiflow/pull_cdc_integration_kafka_test
pingcap/tiflow/pull_cdc_integration_pulsar_test
pingcap/tiflow/pull_cdc_integration_storage_test
pingcap/tiflow/pull_cdc_integration_test
pingcap/tiflow/pull_dm_compatibility_test
pingcap/tiflow/pull_dm_integration_test
pingcap/tiflow/pull_dm_integration_test_next_gen
pingcap/tiflow/pull_syncdiff_integration_test
pull-build
pull-check
pull-error-log-review
pull-unit-test-cdc
Details

In response to this:

/retest pull-verify

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.

@dveeden

dveeden commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

/test pull-verify

@dveeden

dveeden commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@dveeden

dveeden commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

/retest

dveeden and others added 5 commits June 24, 2026 16:58
go-mysql v1.15.0 (PR pingcap#1080) decodes upstream heartbeat events as a
dedicated *replication.HeartbeatEvent type instead of GenericEvent.
DM's switches on *replication.GenericEvent no longer match real
heartbeats, so the validator never persists checkpoints, the syncer
never flushes on idle, and the relay no longer marks heartbeats as
ignored. This caused validator_basic to hang with non-zero pending
rows. Accept both types since DM still injects its own heartbeats
locally as GenericEvent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The test asserted finished_bytes=59674 verbatim, but the tidb-pkg
upgrade in this branch ships a slightly different lightning that
reports 59754 bytes for the same dumped data. Replace the literal
byte count with a backreference assertion that finished_bytes equals
total_bytes (and is non-empty), so the test no longer breaks on
benign size shifts from lightning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ti-chi-bot ti-chi-bot Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 24, 2026
@dveeden
dveeden force-pushed the tagged_gtid branch 2 times, most recently from 1c8f644 to c4f6f36 Compare June 25, 2026 06:56
@ti-chi-bot

ti-chi-bot Bot commented Jun 25, 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

@dveeden

dveeden commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

/test pull-verify

@dveeden

dveeden commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@dveeden

dveeden commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

/retest

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. area/engine Issues or PRs related to Dataflow Engine. 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.

Tagged GTIDs

2 participants