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
parser, executor: consistently lower identity hostnames #33172
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/90afc2aea443eb11d83f69d0c25fbf47a21b754e |
/check-issue-triage-complete |
/run-unit-test |
The list of the tables in mysql> SELECT TABLE_NAME, COLUMN_NAME FROM information_schema.columns WHERE COLUMN_NAME COLLATE utf8mb4_general_ci LIKE '%host' AND TABLE_SCHEMA='mysql' ORDER BY
TABLE_NAME;
+---------------+-------------------+
| TABLE_NAME | COLUMN_NAME |
+---------------+-------------------+
| columns_priv | Host |
| db | Host |
| default_roles | HOST |
| default_roles | DEFAULT_ROLE_HOST |
| global_grants | HOST |
| global_priv | Host |
| role_edges | FROM_HOST |
| role_edges | TO_HOST |
| tables_priv | Host |
| user | Host |
+---------------+-------------------+
10 rows in set (0.13 sec) |
Yeah, I think that's OK. I said I considered doing this but elected not to since it could create issues modifying user data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this also work with prepared statements (both binary and SQL statement interface)?
Also could you give an example of unexpected behaviour?
But still looks good to me :)
/merge |
/run-mysql-test |
There's something wrong with the mysql-test. The new result file has been merged to master, but it's expecting the old values:
|
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #34934 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.0 in PR #34935 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.1 in PR #34936 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.2 in PR #34937 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.3 in PR #34938 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.4 in PR #34939 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-6.0 in PR #34940 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-6.1 in PR #34941 |
TiDB MergeCI notify🔴 Bad News! [2] CI still failing after this pr merged.
|
What problem does this PR solve?
Issue Number: close #33061
Problem Summary:
MySQL always stores the hostname portion of a user identity in lower case (whether it be for a user or a role). It doesn't depend on collations - manual inspection of the tables shows it is lower.
What is changed and how it works?
We have previously implemented this correctly for user grants, and inconsistently for roles. But this is challenging because it requires adjustment in many cases.
This PR takes a different approach where the host portion is lowered in the parser, and then executed in TiDB in lower case. Previous usage of lower casing in the code have been reverted (since it will always be lower).
I have added the tag for compatibility breaker, since it does not modify existing roles or hosts that are in the incorrect case. I considered writing a bootstrap task to fix this (see below) but opted against it because I think it's too destructive to modify user data without their interaction. It should instead be mentioned in the release notes.
Check List
Tests
Side effects
Documentation
Release note