Skip to content

docs: mention EXCHANGE support in mysql compatibility - #22048

Open
doc-claw-bot wants to merge 3 commits into
pingcap:masterfrom
doc-claw-bot:docs-cn/exchange-partition-compat
Open

doc-claw-bot wants to merge 3 commits into
pingcap:masterfrom
doc-claw-bot:docs-cn/exchange-partition-compat

Conversation

@doc-claw-bot

@doc-claw-bot doc-claw-bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

What is changed, added, or deleted? (Required)

This PR updates mysql-compatibility.md to keep the Chinese wording aligned with the English source PR.

It clarifies which partition operations return errors, which partition options are ignored with warnings, and how partition data distribution can differ from MySQL.

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)

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

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

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

Summary by CodeRabbit

  • 文档
    • 更新分区表限制说明:Hash 或 Key 分区表执行 REORGANIZE PARTITION、Key 分区表或含全局索引的分区表执行 EXCHANGE PARTITION,以及部分分区维护操作时会报错。
    • 补充说明:指定分区表空间,或在同一条 ALTER TABLE 中同时修改分区方式和其他属性,会报错;TiDB 忽略 SUBPARTITION 和 LINEAR 关键字并返回警告。
    • 说明 TiDB 与 MySQL 的 Key 分区哈希算法不同,可能导致行落入不同分区,并影响分区选择及 TRUNCATE PARTITION、EXCHANGE PARTITION 的结果。

@ti-chi-bot ti-chi-bot Bot added contribution This PR is from a community contributor. missing-translation-status This PR does not have translation status info. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 6, 2026
@doc-claw-bot doc-claw-bot added type/bugfix This PR fixes a bug. translation/from-docs This PR is translated from a PR in pingcap/docs. ONCALL Relates to documentation oncall. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

文档更新分区表操作限制,并补充 TiDB 对 SUBPARTITION 和 LINEAR 的处理,以及 Key 分区哈希差异对数据分布和分区操作的影响。

Changes: 分区表操作兼容性

Layer / File(s) Summary
分区操作限制
mysql-compatibility.md
文档列出 Hash 或 Key 分区表执行 REORGANIZE PARTITION 的限制、Key 分区表或含全局索引的分区表执行 EXCHANGE PARTITION 的限制,以及其他分区维护、表空间和 ALTER TABLE 操作限制。
分区定义与哈希差异
mysql-compatibility.md
文档说明 TiDB 忽略 SUBPARTITION 定义和 LINEAR 关键字并返回警告。文档还说明 TiDB 与 MySQL 的 Key 分区哈希算法不同,可能影响分区选择及 TRUNCATE PARTITION、EXCHANGE PARTITION 的结果。

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested reviewers: qiancai

Merge Risk: Low · up to 8289d

This documentation update lists the partition operations TiDB rejects and explains how Key and LINEAR partitions differ from MySQL. Two wording points should be fixed. The EXCHANGE PARTITION data-distribution note currently reads as if it applied to KEY tables, which cannot be exchanged. The subpartition warning behavior also differs on 6.5. The global-index link and the Key partition text also need branch-specific edits when the change is applied to older release branches. The risk is low and limited to documentation accuracy.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“docs: mention EXCHANGE support in mysql compatibility”描述了本次变更的核心内容,即在 mysql-compatibility 文档中说明 EXCHANGE 的支持情况。原始摘要显示 PR 主要是列出会报错的分区操作,并补充 SUBPARTITION、LINEAR 关键字及 Key 分区哈希差异的说明。标题仅覆盖 EXCHANGE 这一部分…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed PR 描述包含模板中的主要章节:变更内容说明、受影响版本(已勾选 master 和 v8.5)、相关 PR 链接(已提供英文源 PR 链接)以及 AI 代理参与声明和变更类型。变更内容说明较简短,只概述了分区操作报错、忽略选项警告和分区数据分布差异,但与 raw_summary 所列变更基本一致。第一次贡献者检查清单已被删除,模板允许此操作。整体描述基本完整。
Full details: Title check

Explanation

标题“docs: mention EXCHANGE support in mysql compatibility”描述了本次变更的核心内容,即在 mysql-compatibility 文档中说明 EXCHANGE 的支持情况。原始摘要显示 PR 主要是列出会报错的分区操作,并补充 SUBPARTITION、LINEAR 关键字及 Key 分区哈希差异的说明。标题仅覆盖 EXCHANGE 这一部分,但与变更相关,且未偏离主题。PR 描述也说明本次修改是为了不让页面暗示 EXCHANGE PARTITION 不受支持。因此标题判定为通过。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label Nov 6, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b5679a4 and 5e11f4c.

Files selected for processing: 1

  • mysql-compatibility.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread mysql-compatibility.md Resolved
Comment thread mysql-compatibility.md Resolved
@lilin90 lilin90 self-assigned this Nov 26, 2026
@ti-chi-bot

ti-chi-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

[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 lilin90. 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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5e11f4c and 8ac5a5a.

Files selected for processing: 1

  • mysql-compatibility.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread mysql-compatibility.md Resolved
Comment thread mysql-compatibility.md Resolved
@lilin90 lilin90 added the requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. label Nov 26, 2026
@lilin90 lilin90 removed needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. labels Nov 27, 2026
@ti-chi-bot ti-chi-bot Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 27, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8ac5a5a and 8289d83.

Files selected for processing: 1

  • mysql-compatibility.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread mysql-compatibility.md

更多详情,请参考[分区表文档](/partitioned-table.md)。

* TiDB 会忽略 `SUBPARTITION` 定义并返回警告。

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.

Minor · Functional Correctness · Quick win

说明 v6.5.0 中含 SUBPARTITION 的 RANGE 分区语句的结果

本文档称 TiDB 会忽略 SUBPARTITION 定义并返回警告。该描述不适用于 v6.5.0 的 RANGE 分区语句。在 v6.5.0 中,含 SUBPARTITION 的 RANGE 语句会返回 treat as normal table 警告,并创建普通表,而不保留一级分区。用户可能误以为表仍是 RANGE 分区表。

在 6.5 分支的对应段落中写明该行为和适用版本。v7.1.0 的行为需先在源码中确认,再写入文档。master 文档应只描述当前版本的行为,并标明适用版本,符合文档规范中关于版本变化的要求。

Comment thread mysql-compatibility.md
更多详情,请参考[分区表文档](/partitioned-table.md)。

* TiDB 会忽略 `SUBPARTITION` 定义并返回警告。
* TiDB 会忽略 `LINEAR HASH` 和 `LINEAR KEY` 分区语法中的 `LINEAR` 关键字并返回警告。此外,TiDB 的 `KEY` 分区使用的哈希算法与 MySQL 不同。因此,同一行数据在 TiDB 和 MySQL 中可能落入不同的分区,从而影响分区选择、`TRUNCATE PARTITION` 和 `EXCHANGE PARTITION` 的结果。更多信息,请参见 [Key 分区](/partitioned-table.md#key-分区)和 [TiDB 对 Linear Hash 分区的处理](/partitioned-table.md#tidb-对-linear-hash-分区的处理)。

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.

Minor · Functional Correctness · Quick win

区分 KEY 分区与 LINEAR HASH 分区的 EXCHANGE PARTITION 影响

第 131 行说明 KEY 分区表不支持 EXCHANGE PARTITION。第 139 行却把 EXCHANGE PARTITION 的结果差异归因于 KEY 分区的哈希算法。读者可能认为 KEY 分区表可以执行该操作。

EXCHANGE PARTITION 的结果差异只适用于 LINEAR HASH 分区。TiDB 将 LINEAR HASH 按 HASH 分区处理,且该操作不被禁止。请将 KEY 的分区选择和 TRUNCATE PARTITION 影响,与 LINEAR HASH 的 EXCHANGE PARTITION 影响分开描述。

建议修改

--- "a/mysql-compatibility.md"
+++ "b/mysql-compatibility.md"
@@ -136,7 +136,7 @@
   更多详情,请参考[分区表文档](/partitioned-table.md)。
 
 * TiDB 会忽略 `SUBPARTITION` 定义并返回警告。
-* TiDB 会忽略 `LINEAR HASH` 和 `LINEAR KEY` 分区语法中的 `LINEAR` 关键字并返回警告。此外,TiDB 的 `KEY` 分区使用的哈希算法与 MySQL 不同。因此,同一行数据在 TiDB 和 MySQL 中可能落入不同的分区,从而影响分区选择、`TRUNCATE PARTITION` 和 `EXCHANGE PARTITION` 的结果。更多信息,请参见 [Key 分区](/partitioned-table.md#key-分区)和 [TiDB 对 Linear Hash 分区的处理](/partitioned-table.md#tidb-对-linear-hash-分区的处理)。
+* TiDB 会忽略 `LINEAR HASH` 和 `LINEAR KEY` 分区语法中的 `LINEAR` 关键字并返回警告。此外,TiDB 的 `KEY` 分区使用的哈希算法与 MySQL 不同。因此,同一行数据在 TiDB 和 MySQL 中可能落入不同的分区,从而影响 `KEY` 分区的分区选择和 `TRUNCATE PARTITION` 结果。由于 TiDB 将 `LINEAR HASH` 分区按 `HASH` 分区处理,同一行数据在 TiDB 和 MySQL 中也可能落入不同的分区,从而影响 `LINEAR HASH` 分区的 `EXCHANGE PARTITION` 结果。更多信息,请参见 [Key 分区](/partitioned-table.md#key-分区)和 [TiDB 对 Linear Hash 分区的处理](/partitioned-table.md#tidb-对-linear-hash-分区的处理)。
 
 ### `ANALYZE TABLE`
 
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
* TiDB 会忽略 `LINEAR HASH` 和 `LINEAR KEY` 分区语法中的 `LINEAR` 关键字并返回警告。此外,TiDB 的 `KEY` 分区使用的哈希算法与 MySQL 不同。因此,同一行数据在 TiDB 和 MySQL 中可能落入不同的分区,从而影响分区选择、`TRUNCATE PARTITION` 和 `EXCHANGE PARTITION` 的结果。更多信息,请参见 [Key 分区](/partitioned-table.md#key-分区)和 [TiDB 对 Linear Hash 分区的处理](/partitioned-table.md#tidb-对-linear-hash-分区的处理)。
* TiDB 会忽略 `LINEAR HASH` 和 `LINEAR KEY` 分区语法中的 `LINEAR` 关键字并返回警告。此外,TiDB 的 `KEY` 分区使用的哈希算法与 MySQL 不同。因此,同一行数据在 TiDB 和 MySQL 中可能落入不同的分区,从而影响 `KEY` 分区的分区选择和 `TRUNCATE PARTITION` 结果。由于 TiDB 将 `LINEAR HASH` 分区按 `HASH` 分区处理,同一行数据在 TiDB 和 MySQL 中也可能落入不同的分区,从而影响 `LINEAR HASH` 分区的 `EXCHANGE PARTITION` 结果。更多信息,请参见 [Key 分区](/partitioned-table.md#key-分区)和 [TiDB 对 Linear Hash 分区的处理](/partitioned-table.md#tidb-对-linear-hash-分区的处理)。

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

Labels

contribution This PR is from a community contributor. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. ONCALL Relates to documentation oncall. requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. translation/from-docs This PR is translated from a PR in pingcap/docs. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants