Skip to content

Add docs for placement rules in SQL#6618

Merged
ti-chi-bot merged 61 commits into
pingcap:masterfrom
morgo:placement-rules
Nov 9, 2021
Merged

Add docs for placement rules in SQL#6618
ti-chi-bot merged 61 commits into
pingcap:masterfrom
morgo:placement-rules

Conversation

@morgo
Copy link
Copy Markdown
Contributor

@morgo morgo commented Oct 14, 2021

What is changed, added or deleted? (Required)

This provides docs for placement rules, a 5.3 experimental feature. It is still a work in progress, I'm publishing so I can get feedback from others.

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.

  • master (the latest development version)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 versions)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

What is the related PR or file link(s)?

Docs for pingcap/tidb#18030

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot
Copy link
Copy Markdown
Member

ti-chi-bot commented Oct 14, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • TomShawn

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Details

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 14, 2021
@ti-chi-bot ti-chi-bot requested a review from TomShawn October 14, 2021 01:54
@ti-chi-bot ti-chi-bot added missing-translation-status This PR does not have translation status info. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 14, 2021
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
Comment thread sql-statements/sql-statement-alter-placement-policy.md
Comment thread sql-statements/sql-statement-drop-placement-policy.md Outdated
Comment thread sql-statements/sql-statement-drop-placement-policy.md
@TomShawn TomShawn added the v5.3 This PR/issue applies to TiDB v5.3. label Oct 15, 2021
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
Comment thread schedule-replicas-by-topology-labels.md Outdated
Comment thread sql-statements/sql-statement-create-placement-policy.md
Comment thread sql-statements/sql-statement-show-create-placement-policy.md Outdated
Comment thread sql-statements/sql-statement-show-placement-for.md
Comment thread sql-statements/sql-statement-show-placement.md
@TomShawn TomShawn requested review from djshow832 and nolouch October 18, 2021 02:18
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
Comment thread placement-rules.md Outdated
@morgo morgo marked this pull request as ready for review October 27, 2021 21:14
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 27, 2021
@morgo morgo changed the title Add initial docs for placement rules [DRAFT] Add docs for placement rules in SQL Oct 27, 2021
Copy link
Copy Markdown
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Copy Markdown
Member

@mjonss: 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.

Details

In response to this:

LGTM

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.

Copy link
Copy Markdown
Contributor

@xhebox xhebox left a comment

Choose a reason for hiding this comment

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

While commenting in the lark, I noticed that some problems are highly confusing. I think the user guide may need a FAQ section.

  1. region/zone/rack/host. What label could be used? Are these 4 special? How isolation applies to these labels(region is special)? Region is special that when one region in one rule is failed, other regions will be seen as unavailable. And when PD schedules, it will pick region with higher isolation score first(region has the highest isolation score, host the lowest).
  2. TiFlash banned.
  3. What if there is some unexpected cases and one of the rules can not be met? It is ignored if it can not be met after posted to PD. PD tries to meet all consontraints in one rule as much as possible.
  4. If we want to keep the latency low, we must keep the majority in the primary region. That means when we add a new replica somewhere else, we may need another new region in the primary.
  5. Direct syntax will be converted to a bundle of rules with different role. Sugar will be a bundle of two rules: one for the primary, one for others. And the schedule of PD happens rule by rule, which means the schedule is relatively independent between each role for the direct syntax, but more "smart" for the sugar syntax.
  6. SCHDULE defaults to 'EVEN'
  7. You can not add 2 replicas on the same tikv/store, for one region. For direct syntax, it means it is impossible to archive 2 replicas with only rule FOLLOWERS=2, neither possible with {+xx=m:1, +yy=n:1}, if there is only one tikv/store; for sugar syntax, it means you must provide as many tikv/store as the replicas you specify.

Comment thread placement-rules.md Outdated
@morgo
Copy link
Copy Markdown
Contributor Author

morgo commented Nov 2, 2021

While commenting in the lark, I noticed that some problems are highly confusing. I think the user guide may need a FAQ section.

  1. region/zone/rack/host. What label could be used? Are these 4 special? How isolation applies to these labels(region is special)? Region is special that when one region in one rule is failed, other regions will be seen as unavailable. And when PD schedules, it will pick region with higher isolation score first(region has the highest isolation score, host the lowest).
  2. TiFlash banned.
  3. What if there is some unexpected cases and one of the rules can not be met? It is ignored if it can not be met after posted to PD. PD tries to meet all consontraints in one rule as much as possible.
  4. If we want to keep the latency low, we must keep the majority in the primary region. That means when we add a new replica somewhere else, we may need another new region in the primary.
  5. Direct syntax will be converted to a bundle of rules with different role. Sugar will be a bundle of two rules: one for the primary, one for others. And the schedule of PD happens rule by rule, which means the schedule is relatively independent between each role for the direct syntax, but more "smart" for the sugar syntax.
  6. SCHDULE defaults to 'EVEN'
  7. You can not add 2 replicas on the same tikv/store, for one region. For direct syntax, it means it is impossible to archive 2 replicas with only rule FOLLOWERS=2, neither possible with {+xx=m:1, +yy=n:1}, if there is only one tikv/store; for sugar syntax, it means you must provide as many tikv/store as the replicas you specify.

I've tried to incorporate some of this feedback, but some we'll have to work on in development (for example: with item 1 - we've not added the zone/rack/host labels yet, but they should have the same place as region does in the current docs).We don't clarify the edge-cases in the docs, but we should in future.

Copy link
Copy Markdown
Contributor

@djshow832 djshow832 left a comment

Choose a reason for hiding this comment

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

Rest LGTM

Comment thread placement-rules.md Outdated
Comment thread sql-statements/sql-statement-show-create-placement-policy.md Outdated
Comment thread sql-statements/sql-statement-show-placement-for.md Outdated
Comment thread sql-statements/sql-statement-show-placement-labels.md Outdated
Comment thread sql-statements/sql-statement-show-placement.md Outdated
Comment thread placement-rules-in-sql.md Outdated
morgo and others added 7 commits November 7, 2021 21:14
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Copy link
Copy Markdown
Member

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

rest LGTM:)

Comment thread placement-rules-in-sql.md
>
> Placement Rules in SQL is an experimental feature. The syntax might change before its GA, and there might also be bugs.
>
> If you understand the risks, you can enable this experiment feature by executing `SET GLOBAL tidb_enable_alter_placement = 1;`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a note like:

We recommend using this feature with the help of the official tidb team to help solve specific scenarios. Over-configuration of the placement plan will increase the difficulty of maintenance and troubleshooting, so reasonable planning is very necessary. Usually, the points that need to be considered, including disaster recovery issues, high availability issues, performance issues and so on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @nolouch. Some comments in line:

We recommend using this feature with the help of the official tidb team to help solve specific scenarios. Over-configuration of the placement plan will increase the difficulty of maintenance and troubleshooting, so reasonable planning is very necessary.

To a large degree we removed over configuration as a possibility between the original proposal and the newer proposal. You can no longer specify multiple constraints; and syntactic sugar constraints are mutually exclusive with regular constraints. The only complex scenarios that remain are both FOLLOWER_CONSTRAINTS and CONSTRAINTS can apply, and a user could set a complex constraint in dictionary format.

Usually, the points that need to be considered, including disaster recovery issues, high availability issues, performance issues and so on.

We don't document this well in the current experimental version. Because it is experimental, users are not encouraged to use it in production, so high availability/DR did not seem relevant (yet).

I have an alternative suggestion:

We value your feedback when evaluating experimental features. Please feel free to create a GitHub issue or reach out to us on TiDB Slack. We are interested to both the problems you encounter and your intended use-cases.

Copy link
Copy Markdown
Contributor

@TomShawn TomShawn left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 8, 2021
@TomShawn
Copy link
Copy Markdown
Contributor

TomShawn commented Nov 8, 2021

/remove-status LGT1
/status LGT2

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 8, 2021
@TomShawn
Copy link
Copy Markdown
Contributor

TomShawn commented Nov 9, 2021

/merge

@ti-chi-bot
Copy link
Copy Markdown
Member

@nolouch: 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.

Details

In 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.

@ti-chi-bot
Copy link
Copy Markdown
Member

This pull request has been accepted and is ready to merge.

DetailsCommit hash: 5422310

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 9, 2021
@ti-chi-bot ti-chi-bot merged commit eb30d2a into pingcap:master Nov 9, 2021
@morgo morgo deleted the placement-rules branch November 9, 2021 02:21
@TomShawn TomShawn mentioned this pull request Nov 9, 2021
13 tasks
Comment thread TOC.md
@@ -287,6 +288,7 @@
+ [`CREATE [GLOBAL|SESSION] BINDING`](/sql-statements/sql-statement-create-binding.md)
+ [`CREATE DATABASE`](/sql-statements/sql-statement-create-database.md)
+ [`CREATE INDEX`](/sql-statements/sql-statement-create-index.md)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some newly added documents are missing in the TOC. They are added in #6766.

@TomShawn TomShawn added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR's assignee is translating this PR. labels Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sql-infra Indicates that the Issue or PR belongs to the area of sql-infra and sql-metadata. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. v5.3 This PR/issue applies to TiDB v5.3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants