Skip to content

dm: fix validator handling for unsigned columns#12554

Merged
ti-chi-bot[bot] merged 2 commits intopingcap:masterfrom
OliverS929:master
Mar 13, 2026
Merged

dm: fix validator handling for unsigned columns#12554
ti-chi-bot[bot] merged 2 commits intopingcap:masterfrom
OliverS929:master

Conversation

@OliverS929
Copy link
Contributor

@OliverS929 OliverS929 commented Mar 13, 2026

What problem does this PR solve?

Issue Number: close #12178

What is changed and how it works?

DM validator now normalizes row images with adjustValueFromBinlogData before building RowChange, so UNSIGNED values follow the same conversion path as syncer.
This prevents high-bit UNSIGNED values from being treated as negative signed integers during row key generation and downstream validation.
A regression test is added for an int unsigned primary key case.

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?

No. This only reuses the existing binlog value normalization path in validator.

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

No.

Release note

Fixed false-positive DM validator errors on UNSIGNED columns by normalizing row values before validation.

@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. do-not-merge/needs-triage-completed area/dm Issues or PRs related to DM. labels Mar 13, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 resolves a critical data validation issue within the DM validator where UNSIGNED integer values were being misinterpreted, causing erroneous validation failures. By integrating a consistent value normalization process, the system now correctly handles these data types, preventing false positives and ensuring data integrity during replication and validation.

Highlights

  • Data Validation Fix: The DM validator now normalizes row images using adjustValueFromBinlogData before constructing RowChange objects. This ensures that UNSIGNED values are processed consistently, mirroring the syncer's conversion path.
  • Prevention of Negative Integer Misinterpretation: This change specifically addresses an issue where high-bit UNSIGNED values were incorrectly treated as negative signed integers during row key generation and subsequent validation, leading to false positives.
  • New Regression Test: A new regression test has been added to cover the scenario of an int unsigned primary key, ensuring the fix correctly handles such cases.

🧠 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
  • dm/syncer/data_validator.go
    • Fixed false-positive DM validator errors on UNSIGNED columns by normalizing row values before validation.
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 Mar 13, 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 addresses an issue with the DM validator's handling of unsigned columns, which was causing false-positive errors. The fix involves normalizing row images using adjustValueFromBinlogData before validation, which aligns the validator's behavior with the syncer's. A regression test for an int unsigned primary key has been added to verify the fix.

The changes are logical and the new test case effectively validates the correction. I have one minor suggestion regarding a helper function to improve code clarity. Overall, this is a solid contribution.

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 correctly addresses an issue with UNSIGNED column handling in the DM validator by normalizing row values before validation, aligning it with the syncer's behavior. The addition of a regression test for an int unsigned primary key is a valuable addition. I have one suggestion to simplify the implementation by inlining a new helper function, which would slightly improve code clarity.

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. and removed do-not-merge/needs-triage-completed labels Mar 13, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Mar 13, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, kennytm

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:

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 approved and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 13, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Mar 13, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-03-13 05:06:59.825463801 +0000 UTC m=+585851.337521472: ☑️ agreed by kennytm.
  • 2026-03-13 05:40:58.487737939 +0000 UTC m=+587889.999795610: ☑️ agreed by GMHDBJD.

@ti-chi-bot ti-chi-bot bot merged commit d16456b into pingcap:master Mar 13, 2026
23 checks passed
@OliverS929
Copy link
Contributor Author

/cherry-pick release-8.5

@ti-chi-bot
Copy link
Member

@OliverS929: new pull request created to branch release-8.5: #12555.

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.

@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label Mar 13, 2026
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #12557.

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

Labels

approved area/dm Issues or PRs related to DM. lgtm needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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 validator does not correctly handle UNSIGNED columns

4 participants