Skip to content

docs: mention EXCHANGE support in mysql compatibility - #24655

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

doc-claw-bot wants to merge 3 commits into
pingcap:masterfrom
doc-claw-bot:docs/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 fixes mysql-compatibility.md to list EXCHANGE as a supported partition operation.

The page previously said that other partition operations are ignored for Range/List and Hash/Key partitioned tables, which incorrectly implied that EXCHANGE PARTITION is unsupported. EXCHANGE PARTITION became GA in v6.3.0 and is already documented in partitioned-table.md.

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

  • Documentation
    • Clarified that REORGANIZE PARTITION is unsupported for Hash and Key tables, and EXCHANGE PARTITION is unsupported for Key tables and tables with global indexes.
    • Listed unsupported partition maintenance and tablespace operations, and restrictions on combining partitioning changes with other changes in one ALTER TABLE.
    • Noted that SUBPARTITION definitions are ignored with a warning, as is LINEAR in LINEAR HASH and LINEAR KEY.
    • Explained that TiDB’s Key hash algorithm may differ from MySQL, affecting partition placement, selection, truncation, and exchange behavior.

@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. labels Nov 6, 2026
@ti-chi-bot ti-chi-bot Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

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

No actionable comments were generated in the recent review.

Walkthrough

The compatibility documentation now lists unsupported partition operations, notes cases where TiDB returns warnings, and describes how TiDB’s Key hash algorithm can affect partition behavior compared with MySQL.

Changes: Partition compatibility documentation

Layer / File(s) Summary
Document partition operation rules
mysql-compatibility.md
The documentation lists operations that return errors, including specified REORGANIZE PARTITION, EXCHANGE PARTITION, maintenance, tablespace, and combined ALTER TABLE cases. It also notes that SUBPARTITION definitions and LINEAR are ignored with warnings, and describes Key hash differences that can affect partition behavior.

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

Change: Other

Suggested reviewers: qiancai

Merge Risk: Minimal · up to 42baf

This documentation update corrects the partition compatibility notes. No merge-blocking issues remain.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the EXCHANGE support change in the MySQL compatibility doc, which matches the main change. The raw summary describes a broader rewrite of partition operation rules (REORGANIZE, SUBPART…
Description check Passed The description states the purpose: the page wrongly implied EXCHANGE PARTITION is unsupported, and the PR lists it as supported. It cites the GA version (v6.3.0), the related partitioned-table.md doc…
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.
Full details: Title check

Explanation

The title names the EXCHANGE support change in the MySQL compatibility doc, which matches the main change. The raw summary describes a broader rewrite of partition operation rules (REORGANIZE, SUBPARTITION, LINEAR HASH, Key hash algorithm), so the title covers only part of the changeset, but it refers to a real change in the PR description and objectives.

Full details: Description check

Explanation

The description states the purpose: the page wrongly implied EXCHANGE PARTITION is unsupported, and the PR lists it as supported. It cites the GA version (v6.3.0), the related partitioned-table.md documentation, and reference links. The required 'What is changed' section is filled in, and the version checkboxes and AI agent section are completed. The description does not mention the other changes in the summary (unsupported-operation rules, SUBPARTITION and LINEAR warnings, Key hash algorithm note), so it is incomplete relative to the full diff.

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: 21e0e01
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: dc0684dc-0c78-48a0-992f-a27c3ee60786
Commits

Reviewing files that changed from the base of the PR and between 60f05a0 and 42baf0b.

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.

@doc-claw-bot doc-claw-bot added type/bugfix This PR fixes a bug. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. 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. and removed missing-translation-status This PR does not have translation status info. labels Nov 6, 2026
@lilin90 lilin90 self-assigned this Nov 6, 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

@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 26, 2026
@lilin90
lilin90 requested a review from mjonss November 26, 2026 09:11
@lilin90 lilin90 added requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. labels Nov 26, 2026
@ti-chi-bot

ti-chi-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

In response to a cherrypick label: only pingcap org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually.

1 similar comment
@ti-chi-bot

ti-chi-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

In response to a cherrypick label: only pingcap org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually.

@ti-chi-bot

ti-chi-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

In response to a cherrypick label: only pingcap org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually.

1 similar comment
@ti-chi-bot

ti-chi-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

In response to a cherrypick label: only pingcap org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually.

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

Please make it simpler to understand, by only list what is not supported, instead of a mix of 'not supported' and 'X is supported. Other partition operations are ignored'

Comment thread mysql-compatibility.md Outdated
Comment on lines 170 to 180

@mjonss mjonss Nov 26, 2026 •

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.

Maybe list only what is not supported, instead of mixing "X is supported. Other partition operations are ignored" with "not supported". The current text is also incorrect: KEY partitioned tables do not support EXCHANGE PARTITION (ERROR 8200 (HY000): Unsupported partition type of table k when exchanging partition), and the other operations are not ignored, TiDB returns an error. Verified on v8.5.8 and master.

Suggest replacing lines 171-180 with:

* TiDB does not support the following partition operations and returns an error for them:

    - `REORGANIZE PARTITION` on `HASH` and `KEY` partitioned tables
    - `EXCHANGE PARTITION` on `KEY` partitioned tables, or on partitioned tables that contain [global indexes](/global-indexes.md#limitations-of-global-indexes)
    - `{CHECK|OPTIMIZE|REPAIR|REBUILD} PARTITION`
    - `{DISCARD|IMPORT} PARTITION ... TABLESPACE`
    - `PARTITION BY` or `REMOVE PARTITIONING` combined with other changes in the same `ALTER TABLE` statement

    For more details on partitioning, see [Partitioning](/partitioned-table.md).

* TiDB ignores `SUBPARTITION` definitions and returns a warning.
* TiDB ignores `LINEAR` in `LINEAR HASH` and `LINEAR KEY` partitioning and returns a warning. TiDB also uses a different hash algorithm than MySQL for `KEY` partitioning. Therefore, rows can be placed in different partitions than in MySQL, which affects partition selection, `TRUNCATE PARTITION`, and `EXCHANGE PARTITION`. For more information, see [Key partitioning](/partitioned-table.md#key-partitioning) and [How TiDB handles Linear Hash partitions](/partitioned-table.md#how-tidb-handles-linear-hash-partitions).

@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
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-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. 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/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants