Add docs for placement rules in SQL#7444
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. DetailsReviewer can indicate their review by submitting an approval review. |
|
|
||
| - 作用域:SESSION | GLOBAL | ||
| - 默认值:`ON` | ||
| - 该变量用于控制 DDL 语句是否验证通过 [Placement Rules in SQL](/placement-rules-in-sql.md) 指定的放置规则。 |
|
|
||
| ## 指定放置选项 | ||
|
|
||
| 要使用 Placement Rules in SQL 特性,你需要在 SQL 语句中指定一个或多个放置选项 (placement option)。可通过*直接放置 (direct placement)* 或*放置策略 (placement policy)* 来指定放置选项。 |
There was a problem hiding this comment.
direct placement其实可以看成式 "匿名放置策略"
placement-rules-in-sql.md
Outdated
|
|
||
| ### 高级放置 | ||
|
|
||
| 放置选项 `PRIMARY_REGION`、`REGIONS` 和 `SCHEDULE` 可满足数据放置的基本需求,但会缺乏一些灵活性。在较复杂的场景下,若需要更灵活地放置数据,可以使用高级放置选项 `CONSTRAINTS` 和 `FOLLOWER_CONSTRAINTS`。这两个选项不可同时指定,否则会报错。 |
There was a problem hiding this comment.
是PRIMARY_REGION...和CONSTRAINTS不能混用, 应该说这两类不能混用.
There was a problem hiding this comment.
是说【PRIMARY_REGION、REGIONS 和 SCHEDULE】不能和【CONSTRAINTS】混用吗?
There was a problem hiding this comment.
| 放置选项 `PRIMARY_REGION`、`REGIONS` 和 `SCHEDULE` 可满足数据放置的基本需求,但会缺乏一些灵活性。在较复杂的场景下,若需要更灵活地放置数据,可以使用高级放置选项 `CONSTRAINTS` 和 `FOLLOWER_CONSTRAINTS`。这两个选项不可同时指定,否则会报错。 | |
| 放置选项 `PRIMARY_REGION`、`REGIONS` 和 `SCHEDULE` 可满足数据放置的基本需求,但会缺乏一些灵活性。在较复杂的场景下,若需要更灵活地放置数据,可以使用高级放置选项 `CONSTRAINTS` 和 `FOLLOWER_CONSTRAINTS`。`PRIMARY_REGION`、`REGIONS` 和 `SCHEDULE` 选项不可高级选项同时指定,否则会报错。 |
There was a problem hiding this comment.
包括XXX_CONSTRAINTS也不能混用, 其实就是所有高级放置新介绍的选项都不能和REGION/SCHEDULE混用.
| > | ||
| > Placement Rules in SQL 是一项 TiDB v5.3.0 中引入的实验特性。特性的语法在 GA 前可能会发生变化,还可能存在 bug。如果你知晓潜在的风险,可通过执行 `SET GLOBAL tidb_enable_alter_placement = 1;` 来开启该实验特性。 | ||
|
|
||
| `SHOW PLACEMENT` 汇总了直接放置 (direct placement) 和放置策略 (placement policy) 中的所有放置选项,并以规范的形式呈现这些选项信息。 |
There was a problem hiding this comment.
这个和 SHOW PLACEMENT FOR 高度相似。建议增加一个说明,介绍一下二者的区别。
There was a problem hiding this comment.
@xhebox SHOW PLACEMENT FOR 里的描述是“SHOW PLACEMENT FOR 用于汇总直接放置 (direct placement) 和放置策略 (placement policy) 中所有的放置选项,并为特定表、数据库或分区以规范形式呈现这些选项信息。”
SHOW PLACEMENT FOR 和 SHOW PLACEMENT 还有其他区别吗?
There was a problem hiding this comment.
show placement 会打印policy的名字和对应的选项, 以及所有库表和上面的选项, show placement for只显示库表上的选项.
show placement
| POLICY p1 | PRIMARY_REGION="us-east-1" REGIONS="us-east-1" |
| TABLE test.t2 | PRIMARY_REGION="us-east-1" REGIONS="us-east-1" |
show placement for
| TABLE test.t2 | PRIMARY_REGION="us-east-1" REGIONS="us-east-1" |
这个设计是这样, policy是一些全局, 有名字的, 预先配置好的, placement option(放置选项), 通过执行语句可以绑定到库表上. . direct placement其实就是匿名策略, 直接把选项绑定上去.
Co-authored-by: Enwei <jinenwei@pingcap.com>
|
@xhebox: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. DetailsIn response to this: 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. |
Co-authored-by: Enwei <jinenwei@pingcap.com>
|
@en-jin19: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. DetailsIn response to this:
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. |
Co-authored-by: Enwei <jinenwei@pingcap.com>
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: 4ffe36b |
What is changed, added or deleted? (Required)
Add docs for placement rules in SQL
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?