Skip to content

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #3875

What problem does this PR solve?

Issue Number: close #3876

What is changed and how it works?

This pull request significantly improves the accuracy and robustness of the shared schema mechanism by extending the column information checks to include more detailed attributes. This ensures that schema changes, especially those involving default values, generated columns, or hidden properties, are correctly identified. To validate these enhancements, a new, comprehensive integration test suite has been added and integrated into the CI pipeline, simulating schema evolution and verifying data consistency across different replication targets.

Highlights

  • Enhanced Schema Comparison Logic: The sameColumnsAndIndices function in pkg/common/table_info_helper.go now performs more thorough checks, comparing additional column properties like OriginDefaultValue, DefaultIsExpr, GeneratedStored, Hidden, GeneratedExprString, and Version to ensure accurate schema identification.
  • New Integration Test Suite: A new integration test, correctness_for_shared_column_schema, has been introduced. This suite validates the shared schema handling, particularly focusing on schema evolution scenarios and data consistency across various sink types.

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

@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-8.5.5-release.3-hotfix-0101 labels Jan 1, 2026
@ti-chi-bot
Copy link
Member Author

@hongyunyan This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 1, 2026

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @ti-chi-bot, 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 significantly improves the accuracy and robustness of the shared schema mechanism by extending the column information checks to include more detailed attributes. This ensures that schema changes, especially those involving default values, generated columns, or hidden properties, are correctly identified. To validate these enhancements, a new, comprehensive integration test suite has been added and integrated into the CI pipeline, simulating schema evolution and verifying data consistency across different replication targets.

Highlights

  • Enhanced Schema Comparison Logic: The sameColumnsAndIndices function in pkg/common/table_info_helper.go now performs more thorough checks, comparing additional column properties like OriginDefaultValue, DefaultIsExpr, GeneratedStored, Hidden, GeneratedExprString, and Version to ensure accurate schema identification.
  • New Integration Test Suite: A new integration test, correctness_for_shared_column_schema, has been introduced. This suite validates the shared schema handling, particularly focusing on schema evolution scenarios and data consistency across various sink types.

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

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.

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 enhances the shared schema mechanism by including more column attributes in the schema comparison and hashing logic. This improves the accuracy of detecting schema differences. A new comprehensive integration test has been added to validate these changes.

My review found a critical issue: there are merge conflict markers in tests/integration_tests/run_light_it_in_ci.sh that must be resolved. I also have a suggestion to further improve the hashing logic in pkg/common/table_info_helper.go for better performance by including GeneratedExprString in the hash calculation. Overall, the changes are good and the new test is thorough.

Comment on lines 59 to 64
<<<<<<< HEAD
'row_format tiflash multi_rocks fail_over_ddl_M'
=======
# ds_memory_control
'row_format tiflash multi_rocks fail_over_ddl_M correctness_for_shared_column_schema'
>>>>>>> e9cc243ed (sharedSchema: add more colum info checks for using shared schema (#3875))

Choose a reason for hiding this comment

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

critical

This file contains merge conflict markers (<<<<<<<, =======, >>>>>>>). Please resolve the conflicts before merging.

binary.BigEndian.PutUint64(buf, uint64(boolToInt(col.Hidden)))
sha256Hasher.Write(buf)
binary.BigEndian.PutUint64(buf, col.Version)
sha256Hasher.Write(buf)

Choose a reason for hiding this comment

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

medium

It's great that you've added more column attributes to the hash calculation for better accuracy. I noticed that GeneratedExprString is checked in sameColumnsAndIndices but not included in the hash here. This will lead to hash collisions if two schemas differ only by GeneratedExprString, which can degrade performance as it requires a linear scan to find the correct schema. Since GeneratedExprString is a string, it should be straightforward to include it in the hash. Consider adding it to the hash calculation. You would also need to update the corresponding test case in TestGetOrSetColumnSchema_SameColumnsAndIndices_ChecksAdditionalColumnAttrs to expect expectDigestSame: false for the 'generated expr string' case.

The same applies to OriginDefaultValue and DefaultValue, though hashing them is more complex as they are interface{}. You could consider JSON marshalling them before hashing if performance with many schemas differing only in default values becomes a concern.

		sha256Hasher.Write(buf)
		sha256Hasher.Write([]byte(col.GeneratedExprString))

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 1, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hongyunyan

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 the approved label Jan 1, 2026
@hongyunyan hongyunyan merged commit 83c7c3d into pingcap:8.5.5-release.3-hotfix-0101 Jan 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-8.5.5-release.3-hotfix-0101

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants