-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
tidb: add description about GB18030 #18662
base: master
Are you sure you want to change the base?
Conversation
[LGTM Timeline notifier]Timeline:
|
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
``` | ||
|
||
若开启了新排序规则框架,则在二进制排序规则之外,额外支持 `utf8_general_ci` 和 `utf8mb4_general_ci` 两种大小写和口音不敏感的排序规则: | ||
若开启了新排序规则框架,则在二进制排序规则之外,额外支持若干种大小写和口音不敏感的排序规则: |
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.
这里的“若干”指代能否更具体一些?
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.
Fixed by 63942e5
Co-authored-by: Lilian Lee <lilin@pingcap.com>
@CbcWestwolf 请问这里的GB18030是指 GB 18030-2022 么? |
是的 @shawn0915 |
这是之前企业版支持的特性?要不要明确说明一下是 |
@CbcWestwolf Would you please update the corresponding descriptions in this PR from v8.4 to v9.0, and add description about #18662 (comment)? |
@lilin90 Sure, let me update it after merging the code. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
||
使用 `utf8_general_ci`、`utf8mb4_general_ci`、`utf8_unicode_ci`、`utf8mb4_unicode_ci`、`utf8mb4_0900_ai_ci` 和 `gbk_chinese_ci` 中任一种时,字符串之间的比较是大小写不敏感 (case-insensitive) 和口音不敏感 (accent-insensitive) 的。同时,TiDB 还修正了排序规则的 `PADDING` 行为: | ||
使用 `utf8_general_ci`、`utf8mb4_general_ci`、`utf8_unicode_ci`、`utf8mb4_unicode_ci`、`utf8mb4_0900_ai_ci`、`gbk_chinese_ci` 和 `gb18030_chinese_ci` 中任一种时,字符串之间的比较是大小写不敏感 (case-insensitive) 和口音不敏感 (accent-insensitive) 的。同时,TiDB 还修正了排序规则的 `PADDING` 行为: |
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.
L580 优先级排序 需要加上 gbk_chinese_ci
和 gb18030_chinese_ci
吗?
* 在系统变量 [`character_set_client`](/system-variables.md#character_set_client) 和 [`character_set_connection`](/system-variables.md#character_set_connection) 没有同时设置为 `gb18030` 的情况下,TiDB 处理非法字符的方式与 MySQL 一致。 | ||
* 在 `character_set_client` 和 `character_set_connection` 同时设置为 `gb18030` 的情况下,TiDB 处理非法字符的方式与 MySQL 有如下区别: | ||
|
||
- MySQL 处理非法 GB18030 字符集时,对读和写操作的处理方式不同。 |
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.
需要介绍分别如何处理的吗?或者给个 MySQL 相关内容的链接。
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
|
||
TiDB 和 MySQL 在 `gb18030` 字符集的默认排序规则上存在差异,具体如下: | ||
|
||
- TiDB 的 `gb18030` 字符集的默认排序规则为 `gb18030_bin`。 |
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.
TODO: 更改默认值描述
| Collation | Charset | Id | Default | Compiled | Sortlen | Pad_attribute | | ||
+-------------+---------+-----+---------+----------+---------+---------------+ | ||
| gb18030_bin | gb18030 | 249 | Yes | Yes | 1 | PAD SPACE | | ||
+-------------+---------+-----+---------+----------+---------+---------------+ |
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.
@CbcWestwolf 这里的结果是不是漏了 ”gb18030_chinese_ci“ 这个 collation ?
- MySQL 的 `gb18030` 字符集的默认排序规则为 `gb18030_chinese_ci`。 | ||
- TiDB 支持的 `gb18030_bin` 与 MySQL 支持的 `gb18030_bin` 排序规则实现不同,TiDB 通过将 `gb18030` 字符集转换为 `utf8mb4` 然后进行二进制排序。 | ||
|
||
如果要使 TiDB 兼容 MySQL GB18030 字符集的排序规则,你需要在首次初始化 TiDB 集群时,将 TiDB 配置项 [`new_collations_enabled_on_first_bootstrap`](/tidb-configuration-file.md#new_collations_enabled_on_first_bootstrap) 设置为 `true` 来开启[新的排序规则框架](/character-set-and-collation.md#新框架下的排序规则支持)。开启新的排序规则框架后,查看 GB18030 字符集对应的排序规则,可以看到 TiDB GB18030 默认排序规则已经切换为 `gb18030_chinese_ci`。 |
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.
@CbcWestwolf @hfxsd 我看默认值就是 ture,对于新集群就不会有问题,是不是只需要强调低版本如果设置为了 false,升级到高版本需要手动设置这个配置项为 ture?
- TiDB 的 `gb18030` 字符集的默认排序规则为 `gb18030_bin`。 | ||
- MySQL 的 `gb18030` 字符集的默认排序规则为 `gb18030_chinese_ci`。 |
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.
@CbcWestwolf 这里为何不与 MySQL 保持一致?如果用户 MySQL 默认字符集是 gb18030 没有显式指定 collation,那迁移到 TiDB 就会变成 gb18030_bin,会不会有问题?能否保持一致的行为,来避免类似的问题?
+-----------+---------+----+---------+----------+---------+---------------+ | ||
| Collation | Charset | Id | Default | Compiled | Sortlen | Pad_attribute | | ||
+-----------+---------+----+---------+----------+---------+---------------+ | ||
| gbk_bin | gbk | 87 | Yes | Yes | 1 | PAD SPACE | | ||
+-----------+---------+----+---------+----------+---------+---------------+ |
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.
这里是不是也漏了返回 gbk_chinese_ci 这个collation 结果?
What is changed, added or deleted? (Required)
Add description about GB18030
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions (in Chinese).
What is the related PR or file link(s)?
GB18030
and 2 collations tikv/tikv#17467 and charset,collation: implementGB18030
and 2 collations | tidb-test=pr/2087 tidb#55792 are mergedDo your changes match any of the following descriptions?