Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change collation lookup to be durable across additional engine/versions #158

Merged
merged 9 commits into from
Jun 29, 2024

Conversation

zph
Copy link

@zph zph commented Jun 25, 2024

This patch looks up collation based on INFORMATION_SCHEMA.COLLATIONS and scopes the response to just the two required columns.

The intention is that it will be a more steady reference and interface because we're able to select only the required columns rather than breaking when new columns are added to the interface for SHOW COLLATION....

Context: using this provider broke for v7.5 of TiDB but I think there's a more durable approach by looking up directly the columns needed (more below).

This patch uses that INFORMATION_SCHEMA.COLLATIONS lookup to be compatible with the following:

  1. Mysql 5.7 and 8.0 without special casing
  2. MariaDB without special casing (assumed base on prior compatibility)
  3. compatible with TiDB for 6.x and 7.x (v7.5.1 which advertises as 8.0.11-TiDB-v7.5.1 but lacks the 7th column in SHOW statement previously used)

To Merge:

  • Confirm tests pass (local regressions with 5.7, 8.0 and tidb 6.5 and 7.5 worked)
  • Check if MariaDB has any breaking behavior that would invalidate these assumptions about COLLATIONS table (tests passing there)

This patch looks up collation based on INFORMATION_SCHEMA.COLLATIONS
and scopes the response to just the two required columns.

With this patch it's:
1. Mysql 5.7 and 8.0 without special casing
2. MariaDB without special casing
3. compatible with TiDB for 6.x and 7.x (v7.5.1 which advertises as 8.0.11-TiDB-v7.5.1
   but lacks the 7th column in SHOW statement previously used)
@petoju
Copy link
Owner

petoju commented Jun 26, 2024

Hi, I'm fine with the change itself - but could you please add tests, that will show what you are fixing and to prevent regressions?

Currently, mysql_database tests skip TiDB altogether - maybe there should be some test testing it?

@zph
Copy link
Author

zph commented Jun 26, 2024

@petoju Sounds good 👍. I'll figure out where to integrate the testing and push it up soon for review.

Thank you!

mysql/provider.go Outdated Show resolved Hide resolved
zph added 4 commits June 26, 2024 18:01
These are skipped because of syntactical differences between mysql
and TiDB. These tend to have mariadb/rds/tidb matching more closely
in behavior.
Copy link
Author

@zph zph left a comment

Choose a reason for hiding this comment

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

@petoju Ok, I did a draft of this today. Please take a look when you have time and let me know what questions / feedback you have.

For the tests I now marked as not running in TiDB after enabling TiDB 7.5.3, let me know if you think I should create a second skip function focused on v7 branch to avoid removing runs of those tests for v6.1.

mysql/resource_database_test.go Show resolved Hide resolved
scripts/tidb-test-cluster.sh Show resolved Hide resolved
mysql/resource_database_test.go Show resolved Hide resolved
scripts/tidb-test-cluster.sh Show resolved Hide resolved
@petoju
Copy link
Owner

petoju commented Jun 29, 2024

For the tests I now marked as not running in TiDB after enabling TiDB 7.5.3, let me know if you think I should create a second skip function focused on v7 branch to avoid removing runs of those tests for v6.1.

This is also fine for now. In the longer term, they should probably be fixed. That's just to avoid someone breaking it.

@petoju petoju merged commit 4802499 into petoju:master Jun 29, 2024
14 checks passed
@petoju
Copy link
Owner

petoju commented Jun 29, 2024

Released in v3.0.62

@zph
Copy link
Author

zph commented Jun 29, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants