-
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
Optimize placement rules in sql #10736
base: master
Are you sure you want to change the base?
Conversation
[REVIEW NOTIFICATION] This pull request has not been approved. 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. |
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.
还是需要仔细的想一下, 这个PR虽然从用户角度来说还不错, 但不够严谨.
@@ -9,7 +9,7 @@ Placement Rules in SQL 特性用于通过 SQL 接口配置数据在 TiKV 集群 | |||
|
|||
> **注意:** | |||
> | |||
> Placement Rules in SQL 底层的实现依赖 PD 提供的放置规则 (placement rules) 功能,参考 [Placement Rules 使用文档](/configure-placement-rules.md)。在 Placement Rules in SQL 语境下,放置规则既可以代指绑定对象的放置策略 (placement policy),也可以代指 TiDB 发给 PD 的放置规则。 | |||
> Placement Rules in SQL 底层的实现依赖 PD 提供的放置规则 (placement rules) 功能,参考 [Placement Rules 使用文档](/configure-placement-rules.md)。在 Placement Rules in SQL 语境下,放置规则既可以代指绑定对象的放置规则 (placement policy),也可以代指 TiDB 发给 PD 的放置规则。 |
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.
放置规则和放置策略是有意为止. 因为本质上placement rules是PD的feat, 而placement rules in SQL是tidb的feat. 所以故意在placement rules in SQL方面使用放置策略, 而PD沿用原有的放置规则翻译.
**参数描述** | ||
|
||
- `{policy_name}`: 策略名。 | ||
- `{primary_region}`: Raft Leader 将放置在 `region` 标签与该值相等的 TiKV 节点上。 | ||
- `{regions}`: 这是一个英文半角逗号分隔的列表,Raft Followers 将放置在 `region` 标签与该列表中每一个对象相等的 TiKV 节点上。 | ||
|
||
如策略名称为 `my_policy`, Raft 的 Leader 希望放置于 `region` 带有 `us-east-1` 的 TiKV, Raft 的 Follower 希望放置于 `region` 带有 `us-east-1` 或 `us-west-1` 的 TiKV 时,SQL 语句为: |
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.
我不知道应不应该在这里解释这么多, 因为实际上/sql-statements/sql-statement-create-placement-policy.md
有更详细的解释. 如果要在入口文档解释这么多, 那子文档就没有意义了. 下面几个语句同理. 你也许可以提示一下还有子文档这件事情. 这个可以请文档的同学来看一下.
而且这是一个英文半角逗号分隔的列表,Raft Followers 将放置在
region 标签与该列表中每一个对象相等的 TiKV 节点上。
这个是有问题的. Sugar syntax有一个默认数量, 如果你指定的比默认数量还多, 就不会每个都有follower.
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.
这个当然是可以有的, 子文档按道理说是最终参考, 应该明确.
``` | ||
|
||
## 查看放置规则 | ||
## 查询表已绑定放置规则名称 |
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.
不通顺, 有语病
|
||
要修改放置策略,你可以使用 [`ALTER PLACEMENT POLICY`](/sql-statements/sql-statement-alter-placement-policy.md) 语句。修改将传播到所有绑定此放置策略的对象。 | ||
[创建放置规则](#创建放置规则)后,才可绑定放置规则。可使用 `CREATE TABLE` 或者 `ALTER TABLE` 将策略绑定至表或分区表。放置规则为全局作用域,不与任何数据库表结构相关联。因此,绑定放置规则时,无需任何额外的权限。 |
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.
放置选项
PRIMARY_REGION
、REGIONS
和SCHEDULE
可满足数据放置的基本需求,但会缺乏一些灵活性。在较复杂的场景下,若需要更灵活地放置数据,可以使用高级放置选项CONSTRAINTS
和FOLLOWER_CONSTRAINTS
。PRIMARY_REGION
、REGIONS
和SCHEDULE
选项不可与CONSTRAINTS
选项同时指定,否则会报错。
这个详细说明建议保留, 或者至少应该有个明确规则. 因为比如FOLLOWERS
其实是两个参数共有的选项. 不明说有些语言不详, 可能造成混淆.
@TomShawn 格式:有几处加粗斜体显示不对,建议修正
|
@Icemap: PR needs rebase. 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 kubernetes/test-infra repository. |
Removed the needs-cherry-pick-release-6.3 label because the v6.3 docs have been archived at https://docs-archive.pingcap.com/zh/tidb/v6.3 and will no longer receive new updates. |
Removed the needs-cherry-pick-release-6.4 label because the v6.4 docs have been archived at https://docs-archive.pingcap.com/zh/tidb/v6.4 and will no longer receive new updates. |
Removed the needs-cherry-pick-release-6.6 label because the v6.6 docs have been archived at https://docs-archive.pingcap.com/zh/tidb/v6.6 and will no longer receive new updates. |
Removed the |
@Icemap: The following test failed, say
Full PR test history. Your PR dashboard. 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 kubernetes/test-infra repository. I understand the commands that are listed here. |
First-time contributors' checklist
What is changed, added or deleted? (Required)
重构整篇
Placement Rules in SQL
文档,用户反馈结构较乱。规范用词:
参数
、选项
,统一为参数
放置规则
、放置策略
,统一为放置规则
(与 configure-placement-rules.md 保持一致)更改结构:
绑定放置规则
中,创建、更新、删除 放置规则的部分单独成章。高级参数
中,不应放在示例
下的部分,转为在放置规则参数参考
一章中描述。参数解释:
SCHEDULE
中的EVEN
/MAJORITY_IN_PRIMARY
原本无任何解释,SQL 参数亦无。需要相关技术审核,以防出现谬误。PRIMARY_REGION
/REGIONS
中较晦涩的句法。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)?
Do your changes match any of the following descriptions?