Skip to content

Conversation

@lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Dec 22, 2025

First-time contributors' checklist

What is changed, added or deleted? (Required)

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

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

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

  • This PR is translated from:
  • Other reference link(s):

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

Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 22, 2025
@lhy1024 lhy1024 changed the title pd,tidb:: support affinity schedule pd,tidb: support affinity schedule Dec 22, 2025
@qiancai qiancai self-assigned this Dec 22, 2025
@qiancai qiancai added v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Dec 22, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 23, 2025

@lcwangchao: adding LGTM is restricted to approvers and reviewers in OWNERS files.

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 kubernetes-sigs/prow repository.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 23, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from qiancai. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: lhy1024 <admin@liudos.us>

- 非分区表:`AFFINITY='table'`。
- 分区表:`AFFINITY='partition'`,每个分区会生成独立的亲和性分组。
- 取消亲和性:设置为 `AFFINITY=''` 或 `AFFINITY='none'`。

Choose a reason for hiding this comment

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

当表从affinity='table' or 'partition' 修改为 'none' 后,会立即出发pd的重新调度(包括分裂)吗,什么时候触发执行,这个要说明下

## 支持的亲和性级别

- 非分区表:`AFFINITY='table'`。
- 分区表:`AFFINITY='partition'`,每个分区会生成独立的亲和性分组。

Choose a reason for hiding this comment

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

文字最后补充说明:如若表有4个分区,则会分别针对每个分区生成亲和性分组,故总共有4个独立的亲和性分组。


- `LEADER_STORE_ID`、`VOTER_STORE_IDS`:PD 为该表或分区记录的目标 Leader 副本和 Voter 副本所在的 store ID。当亲和性尚未确定时显示为 `NULL`。
- `STATUS`:`Pending` 表示 PD 尚未进行亲和性调度,`Preparing` 表示正在调度 Region 以满足亲和性要求,`Stable` 表示所有 Region 已经达到目标分布。
- `REGION_COUNT`:当前在该亲和性组中的 Region 数量。
Copy link

@zhaoshangzi zhaoshangzi Dec 23, 2025

Choose a reason for hiding this comment

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

Region_count 和 Affinity_region_count 的含义没有说明清楚,我的理解是不是如下:

  1. 若 region_count > Affinity_region_count 时,表示pd调度没有完成;
  2. 若 region_count = Affinity_region_count 时,表示pd调度工作完成;
  3. 若 region_count < Affinity_region_count 时,表示pd调度工作完成,同时已经开始执行merge操作,但无法说明merge是否完成,是否完成需要手工根据max-affinity-merge-region-size和普通region(某参数)计算出来

Copy link
Contributor Author

Choose a reason for hiding this comment

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

【若 region_count < Affinity_region_count 时】不存在这种状态;若 region_count = Affinity_region_count 时,且两者同步减少,说明正在 merge

Copy link

@zhaoshangzi zhaoshangzi left a comment

Choose a reason for hiding this comment

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

以下2个文件需要修改
sql-statements/sql-statement-show-affinity.md
table-affinity.md

@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 23, 2025

@zhaoshangzi: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

以下2个文件需要修改
sql-statements/sql-statement-show-affinity.md
table-affinity.md

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-sigs/prow repository.

Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 23, 2025

@lhy1024: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-verify aedfcf3 link true /test pull-verify

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 24, 2025

@zhaoshangzi: adding LGTM is restricted to approvers and reviewers in OWNERS files.

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 kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-translation-status This PR does not have translation status info. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants