-
Notifications
You must be signed in to change notification settings - Fork 710
docs: update PLAN REPLAYER object storage behavior #22549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
zeminzhou
wants to merge
6
commits into
release-8.5
from
docs/plan-replayer-object-storage-release-8.5
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8e3c599
docs: update plan replayer object storage behavior
zeminzhou a89b1c6
Update sql-plan-replayer.md
zeminzhou 710ef96
Update system-variables.md
zeminzhou 0fdbf03
Update system-variables.md
zeminzhou 979b73a
Update sql-plan-replayer.md
zeminzhou eb8f6d3
Update sql-plan-replayer.md
zeminzhou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,8 @@ You can use `PLAN REPLAYER` to save the on-site information of a TiDB cluster. T | |
| PLAN REPLAYER DUMP [WITH STATS AS OF TIMESTAMP expression] EXPLAIN [ANALYZE] sql-statement; | ||
| ``` | ||
|
|
||
| By default, `PLAN REPLAYER` stores generated files in local storage. To store the generated `ZIP` files in an external storage, you can set the [`tidb_cloud_storage_uri`](/system-variables.md#tidb_cloud_storage_uri-new-in-v740) system variable to a valid external storage URI. For supported URI formats, see [URI Formats of External Storage Services](/external-storage-uri.md). | ||
|
|
||
| Based on `sql-statement`, TiDB sorts out and exports the following on-site information: | ||
|
|
||
| - TiDB version | ||
|
|
@@ -54,11 +56,14 @@ plan replayer dump with stats as of timestamp '2023-07-17 12:00:00' explain sele | |
| plan replayer dump with stats as of timestamp '442012134592479233' explain select * from t; | ||
| ``` | ||
|
|
||
| `PLAN REPLAYER DUMP` packages the table information above into a `ZIP` file and returns the file identifier as the execution result. | ||
| `PLAN REPLAYER DUMP` packages the table information above into a `ZIP` file and returns the download information as the execution result: | ||
|
|
||
| - If the configured storage backend supports presigned URLs, TiDB returns a presigned URL. | ||
| - Otherwise, TiDB returns a file token. | ||
|
|
||
| > **Note:** | ||
| > | ||
| > The `ZIP` file is stored in a TiDB cluster for at most one hour. After one hour, TiDB will delete it. | ||
| > TiDB keeps the result file for at most one hour. After one hour, TiDB deletes it from the corresponding local or external storage. | ||
|
|
||
| ```sql | ||
| MySQL [test]> plan replayer dump explain select * from t; | ||
|
|
@@ -88,6 +93,17 @@ SELECT @@tidb_last_plan_replayer_token; | |
| 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: | ||
|
|
||
| ```sql | ||
| +----------------------------------------------------------------------------------------------------------------------+ | ||
| | Dump_link | | ||
| +----------------------------------------------------------------------------------------------------------------------+ | ||
| | https://storage.example.com/replayer_xxx.zip?X-Amz-Algorithm=...&X-Amz-Credential=...&X-Amz-Signature=... | | ||
| +----------------------------------------------------------------------------------------------------------------------+ | ||
| 1 row in set (0.00 sec) | ||
| ``` | ||
|
|
||
| When there are multiple SQL statements, you can obtain the result of the `PLAN REPLAYER DUMP` execution using a file. The results of multiple SQL statements are separated by `;` in this file. | ||
|
|
||
| ```sql | ||
|
|
@@ -111,7 +127,17 @@ SELECT @@tidb_last_plan_replayer_token; | |
| 1 row in set (0.00 sec) | ||
| ``` | ||
|
|
||
| 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: | ||
|
|
||
| {{< copyable "shell-regular" >}} | ||
|
|
||
| ```shell | ||
| curl "${presigned_url}" > plan_replayer.zip | ||
| ``` | ||
|
|
||
| The presigned URL is valid for up to one hour. | ||
|
|
||
| If `PLAN REPLAYER DUMP` returns a file token, you need to use the TiDB HTTP interface and the file token to download the file: | ||
|
|
||
| {{< copyable "shell-regular" >}} | ||
|
|
||
|
|
@@ -261,11 +287,13 @@ mysql> SELECT * FROM mysql.plan_replayer_status; | |
| 3 rows in set (0.00 sec) | ||
| ``` | ||
|
|
||
| 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. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If tidb_cloud_storage_uri setted , what are the contents of column '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). | ||
|
|
||
| > **Note:** | ||
| > | ||
| > The result file of `PLAN REPLAYER CAPTURE` is kept in the TiDB cluster for up to one week. After one week, TiDB deletes the file. | ||
| > TiDB keeps the result file of `PLAN REPLAYER CAPTURE` for up to one week. After one week, TiDB deletes it from the corresponding local or external storage. | ||
|
|
||
| ### Remove the capture tasks | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will TiDB delete the result file on external storage after one hour ?