Skip to content

docs: update PLAN REPLAYER object storage behavior#22557

Open
zeminzhou wants to merge 2 commits intopingcap:masterfrom
zeminzhou:docs/plan-replayer-object-storage-reopen
Open

docs: update PLAN REPLAYER object storage behavior#22557
zeminzhou wants to merge 2 commits intopingcap:masterfrom
zeminzhou:docs/plan-replayer-object-storage-reopen

Conversation

@zeminzhou
Copy link
Copy Markdown
Contributor

@zeminzhou zeminzhou commented Mar 12, 2026

What is changed, added or deleted? (Required)

This PR replaces #22548 because the original PR can no longer be reopened.

Update the PLAN REPLAYER documentation to reflect the new object storage behavior introduced in TiDB:

  • document that PLAN REPLAYER can store generated files in the storage configured by tidb_cloud_storage_uri
  • clarify that PLAN REPLAYER DUMP now returns either a file token or a presigned URL depending on the backend capability
  • document the corresponding download flow and presigned URL validity
  • clarify that PLAN REPLAYER CAPTURE files can also be stored in external storage while the token column still records the file token
  • update related system variable descriptions in system-variables.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)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

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

This documentation update is based on the following TiDB PRs:

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Mar 12, 2026

[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 assign qiancai for approval. 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

@ti-chi-bot ti-chi-bot bot added the missing-translation-status This PR does not have translation status info. label Mar 12, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the TiDB documentation for the PLAN REPLAYER feature to accurately reflect its enhanced object storage capabilities. It details how PLAN REPLAYER can now utilize external cloud storage, the new dual output options (file token or presigned URL) for PLAN REPLAYER DUMP, and the corresponding download procedures. These changes ensure that users have up-to-date information regarding file storage, retrieval, and the role of the tidb_cloud_storage_uri system variable.

Highlights

  • External Storage Support: The PLAN REPLAYER feature now supports storing generated files in external storage, configured via the tidb_cloud_storage_uri system variable.
  • Flexible Output for DUMP: PLAN REPLAYER DUMP can now return either a file token or a presigned URL, depending on the capabilities of the configured storage backend.
  • Enhanced Download Guidance: The documentation provides clear instructions for downloading files using both file tokens and presigned URLs, including details on presigned URL validity.
  • CAPTURE Files in External Storage: PLAN REPLAYER CAPTURE files can also be stored in external storage, with the token column continuing to record the file token for retrieval.
  • System Variable Updates: Descriptions for tidb_cloud_storage_uri and @@tidb_last_plan_replayer_token system variables have been updated to reflect these new storage behaviors.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • sql-plan-replayer.md
    • Added information about PLAN REPLAYER using tidb_cloud_storage_uri for external storage.
    • Updated PLAN REPLAYER DUMP output to include presigned URLs.
    • Clarified the download process for both presigned URLs and file tokens.
    • Updated note on file retention to include external storage.
    • Added information about PLAN REPLAYER CAPTURE using external storage.
  • system-variables.md
    • Updated tidb_cloud_storage_uri description to include PLAN REPLAYER as a feature that uses it.
    • Updated @@tidb_last_plan_replayer_token description to mention presigned URLs.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 12, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation for PLAN REPLAYER to reflect its new object storage capabilities. The changes clarify how PLAN REPLAYER DUMP and PLAN REPLAYER CAPTURE handle file storage with tidb_cloud_storage_uri, including the introduction of presigned URLs. The related system variable documentation is also updated. The changes are clear and accurate. I have one minor suggestion to improve stylistic consistency.

The method of downloading the file of `PLAN REPLAYER CAPTURE` is the same as that of `PLAN REPLAYER`. For details, see [Examples of exporting cluster information](#examples-of-exporting-cluster-information).
If [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) is configured, the captured file is also stored in the configured external storage. The `token` column still records the file token.

To download the file of `PLAN REPLAYER CAPTURE`, use the `token` value together with the TiDB HTTP interface. This is the same as the file-token based download flow described in [Examples of exporting cluster information](#examples-of-exporting-cluster-information).
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.

low

For consistency with other instructions in this document that use the second person ("you"), consider rephrasing this sentence to use "you can".

Suggested change
To download the file of `PLAN REPLAYER CAPTURE`, use the `token` value together with the TiDB HTTP interface. This is the same as the file-token based download flow described in [Examples of exporting cluster information](#examples-of-exporting-cluster-information).
To download the file of `PLAN REPLAYER CAPTURE`, you can use the `token` value together with the TiDB HTTP interface. This is the same as the file-token based download flow described in [Examples of exporting cluster information](#examples-of-exporting-cluster-information).
References
  1. The style guide recommends writing in the second person ('you') when addressing users. Using 'you can' would be more consistent with other parts of this document. (link)

@hfxsd hfxsd added translation/doing This PR's assignee is translating this PR. v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3. and removed missing-translation-status This PR does not have translation status info. labels Mar 12, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Mar 12, 2026

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

@Oreoxmt Oreoxmt added the area/tidb-cloud This PR relates to the area of TiDB Cloud. label Mar 17, 2026
Copy link
Copy Markdown
Collaborator

@Oreoxmt Oreoxmt 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

- This variable is used to specify the Amazon S3 cloud storage URI to enable [Global Sort](/tidb-global-sort.md). After enabling the [TiDB Distributed eXecution Framework (DXF)](/tidb-distributed-execution-framework.md), you can use the Global Sort feature by configuring the URI and pointing it to an appropriate cloud storage path with the necessary permissions to access the storage. For more details, see [Amazon S3 URI format](/external-storage-uri.md#amazon-s3-uri-format).
- The following statements can use the Global Sort feature.
- This variable is used to specify the cloud storage URI for TiDB features that use external storage. After enabling the [TiDB Distributed eXecution Framework (DXF)](/tidb-distributed-execution-framework.md), you can use the [Global Sort](/tidb-global-sort.md) feature by configuring the URI and pointing it to an appropriate cloud storage path with the necessary permissions to access the storage. [`PLAN REPLAYER`](/sql-plan-replayer.md) also uses this URI to store the generated files. If this variable is empty, `PLAN REPLAYER` uses local storage. For URI formats, see [URI Formats of External Storage Services](/external-storage-uri.md).
- The following statements or features can use this variable.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- The following statements or features can use this variable.
- The following statements and features use this variable:

- Default value: `""`
- This variable is used to specify the Amazon S3 cloud storage URI to enable [Global Sort](/tidb-global-sort.md). After enabling the [TiDB Distributed eXecution Framework (DXF)](/tidb-distributed-execution-framework.md), you can use the Global Sort feature by configuring the URI and pointing it to an appropriate cloud storage path with the necessary permissions to access the storage. For more details, see [Amazon S3 URI format](/external-storage-uri.md#amazon-s3-uri-format).
- The following statements can use the Global Sort feature.
- This variable is used to specify the cloud storage URI for TiDB features that use external storage. After enabling the [TiDB Distributed eXecution Framework (DXF)](/tidb-distributed-execution-framework.md), you can use the [Global Sort](/tidb-global-sort.md) feature by configuring the URI and pointing it to an appropriate cloud storage path with the necessary permissions to access the storage. [`PLAN REPLAYER`](/sql-plan-replayer.md) also uses this URI to store the generated files. If this variable is empty, `PLAN REPLAYER` uses local storage. For URI formats, see [URI Formats of External Storage Services](/external-storage-uri.md).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- This variable is used to specify the cloud storage URI for TiDB features that use external storage. After enabling the [TiDB Distributed eXecution Framework (DXF)](/tidb-distributed-execution-framework.md), you can use the [Global Sort](/tidb-global-sort.md) feature by configuring the URI and pointing it to an appropriate cloud storage path with the necessary permissions to access the storage. [`PLAN REPLAYER`](/sql-plan-replayer.md) also uses this URI to store the generated files. If this variable is empty, `PLAN REPLAYER` uses local storage. For URI formats, see [URI Formats of External Storage Services](/external-storage-uri.md).
- This variable is used to specify the cloud storage URI for TiDB features that use external storage. After enabling the [TiDB Distributed eXecution Framework (DXF)](/tidb-distributed-execution-framework.md), you can use the [Global Sort](/tidb-global-sort.md) feature by configuring the URI and pointing it to an appropriate cloud storage path with the necessary permissions to access the storage. [`PLAN REPLAYER`](/sql-plan-replayer.md) also uses this URI to store generated files. If this variable is empty, `PLAN REPLAYER` uses local storage. For supported URI formats, see [URI Formats of External Storage Services](/external-storage-uri.md).

PLAN REPLAYER DUMP [WITH STATS AS OF TIMESTAMP expression] EXPLAIN [ANALYZE] sql-statement;
```

By default, TiDB stores files generated by `PLAN REPLAYER` in local storage. If you set [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) to a valid external storage URI, TiDB stores the generated `ZIP` files in the specified storage. For supported URI formats, see [URI Formats of External Storage Services](/external-storage-uri.md).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
By default, TiDB stores files generated by `PLAN REPLAYER` in local storage. If you set [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) to a valid external storage URI, TiDB stores the generated `ZIP` files in the specified storage. For supported URI formats, see [URI Formats of External Storage Services](/external-storage-uri.md).
By default, TiDB stores files generated by `PLAN REPLAYER` in local storage. If you set [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) to a valid external storage URI, TiDB stores the generated `ZIP` files in the specified location. For supported URI formats, see [URI Formats of External Storage Services](/external-storage-uri.md).

1 row in set (0.00 sec)
```

If the configured storage backend supports presigned URLs, the result returned by `PLAN REPLAYER DUMP` or `@@tidb_last_plan_replayer_token` is a presigned URL instead of a file token. For example:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
If the configured storage backend supports presigned URLs, the result returned by `PLAN REPLAYER DUMP` or `@@tidb_last_plan_replayer_token` is a presigned URL instead of a file token. For example:
If the configured storage backend supports presigned URLs, the result returned by `PLAN REPLAYER DUMP` or `tidb_last_plan_replayer_token` is a presigned URL instead of a file token. For example:

```

The method of downloading the file of `PLAN REPLAYER CAPTURE` is the same as that of `PLAN REPLAYER`. For details, see [Examples of exporting cluster information](#examples-of-exporting-cluster-information).
If [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) is configured, the captured file is also stored in the configured external storage. The `token` column in the `mysql.plan_replayer_status` table still records the file token of the generated capture file.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
If [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) is configured, the captured file is also stored in the configured external storage. The `token` column in the `mysql.plan_replayer_status` table still records the file token of the generated capture file.
If [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) is configured, TiDB also stores captured files in the specified external storage. The `token` column in the `mysql.plan_replayer_status` table records the file token of each captured file.

The method of downloading the file of `PLAN REPLAYER CAPTURE` is the same as that of `PLAN REPLAYER`. For details, see [Examples of exporting cluster information](#examples-of-exporting-cluster-information).
If [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) is configured, the captured file is also stored in the configured external storage. The `token` column in the `mysql.plan_replayer_status` table still records the file token of the generated capture file.

To download the file of `PLAN REPLAYER CAPTURE`, use the value in the `token` column of `mysql.plan_replayer_status` together with the TiDB HTTP interface. This is the same as the file-token based download flow described in [Examples of exporting cluster information](#examples-of-exporting-cluster-information).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
To download the file of `PLAN REPLAYER CAPTURE`, use the value in the `token` column of `mysql.plan_replayer_status` together with the TiDB HTTP interface. This is the same as the file-token based download flow described in [Examples of exporting cluster information](#examples-of-exporting-cluster-information).
To download a file generated by `PLAN REPLAYER CAPTURE`, use the value in the `token` column together with the TiDB HTTP interface. This process is the same as the file token-based download flow described in [Examples of exporting cluster information](#examples-of-exporting-cluster-information).

```

Because the file cannot be downloaded on MySQL Client, you need to use the TiDB HTTP interface and the file identifier to download the file:
If `PLAN REPLAYER DUMP` returns a presigned URL, you can use the URL directly to download the file:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
If `PLAN REPLAYER DUMP` returns a presigned URL, you can use the URL directly to download the file:
If `PLAN REPLAYER DUMP` returns a presigned URL, you can use the URL directly to download the file. The presigned URL is valid for up to one hour.

Comment on lines +137 to +138

The presigned URL is valid for up to one hour.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The presigned URL is valid for up to one hour.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Mar 24, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Mar 24, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-03-24 05:42:41.270037868 +0000 UTC m=+246957.306108128: ☑️ agreed by Oreoxmt.

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

Labels

area/tidb-cloud This PR relates to the area of TiDB Cloud. needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. translation/doing This PR's assignee is translating this PR. 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