Skip to content
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

tikv-control: support the Flashback command trigger #14133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HuSharp
Copy link
Contributor

@HuSharp HuSharp commented Jun 2, 2023

What is changed, added or deleted? (Required)

tikv-control: support the Flashback command trigger (new feature in v6.5.3)

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)

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

Signed-off-by: husharp <[email protected]>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 2, 2023

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 2, 2023
@Oreoxmt Oreoxmt added translation/doing This PR’s assignee is translating this PR. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jun 6, 2023
@ti-chi-bot ti-chi-bot bot removed the missing-translation-status This PR does not have translation status info. label Jun 6, 2023
@Oreoxmt Oreoxmt requested a review from ran-huang June 6, 2023 04:59
@Oreoxmt Oreoxmt added the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Jun 6, 2023
flashback all stores success!
```

> **注意:**
Copy link
Member

Choose a reason for hiding this comment

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

这块拿到最前面吧,不然用户可能执行完了才看到这条,或者就作为步骤的一部分,而不是注意事项。

@@ -459,6 +459,8 @@ config show cluster-version
config set store-limit-version v2 // 使用 Store Limit v2
```

- `halt-scheduling` 用于停止调度。一旦它被打开,PD 将停止调度,且任何其他的调度配置都将被忽略。
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- `halt-scheduling` 用于停止调度。一旦它被打开,PD 将停止调度,且任何其他的调度配置都将被忽略
- `halt-scheduling` 用于停止调度。开启该配置后,PD 将停止调度,并且忽略其他的调度配置

Comment on lines +552 to +576
### Flashback

TiDB v6.4.0 引入了 [FLASHBACK CLUSTER TO TIMESTAMP 语法](/sql-statements/sql-statement-flashback-to-timestamp.md),其功能是将集群的数据恢复到特定的时间点。为了更方便脱离 TiDB 进行使用,我们提供了 `flashback` 指令,支持在 TiKV 层面进行

- `--pd` 选项可以指定 PD 的 endpoints。
- `-v` 选项可以指定需要 Flashback 的时间点。
- 默认情况下,会对整个集群进行 Flashback。也提供如下方式对指定 Region 进行操作:
- 如果需要操作指定的 Region,可以使用 `-r` 选项,多个 Region 以 `,` 分隔
- 要操作某个 key 范围中的所有 Region,可在命令中使用 `--start` 和 `--end` 参数(默认不限范围,采用 Hex 格式)

需要对整个集群进行操作时,用法及输出内容如下所示:

```shell
tikv-ctl --pd 127.0.0.1:2379 flashback --version 430315739761082369
```

```
flashback all stores success!
```

> **注意:**
>
> - 在使用前,需要通过 `./pd-ctl config set halt-scheduling true` [停止 PD 调度](pd-control.md#config-show--set-option-value--placement-rules)。
> - 该命令采用最新的时间戳写入特定时间点的旧数据,但不会删除当前数据,所以在使用前请确保集群有足够的存储空间来同时容纳旧数据和当前数据。
> - 该命令只支持本地模式。在运行成功后,会打印 `flashback all stores success!`。
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### Flashback
TiDB v6.4.0 引入了 [FLASHBACK CLUSTER TO TIMESTAMP 语法](/sql-statements/sql-statement-flashback-to-timestamp.md),其功能是将集群的数据恢复到特定的时间点。为了更方便脱离 TiDB 进行使用,我们提供了 `flashback` 指令,支持在 TiKV 层面进行
- `--pd` 选项可以指定 PD 的 endpoints。
- `-v` 选项可以指定需要 Flashback 的时间点。
- 默认情况下,会对整个集群进行 Flashback。也提供如下方式对指定 Region 进行操作:
- 如果需要操作指定的 Region,可以使用 `-r` 选项,多个 Region 以 `,` 分隔
- 要操作某个 key 范围中的所有 Region,可在命令中使用 `--start` 和 `--end` 参数(默认不限范围,采用 Hex 格式)
需要对整个集群进行操作时,用法及输出内容如下所示:
```shell
tikv-ctl --pd 127.0.0.1:2379 flashback --version 430315739761082369
```
```
flashback all stores success!
```
> **注意:**
>
> - 在使用前,需要通过 `./pd-ctl config set halt-scheduling true` [停止 PD 调度](pd-control.md#config-show--set-option-value--placement-rules)
> - 该命令采用最新的时间戳写入特定时间点的旧数据,但不会删除当前数据,所以在使用前请确保集群有足够的存储空间来同时容纳旧数据和当前数据。
> - 该命令只支持本地模式。在运行成功后,会打印 `flashback all stores success!`
### Flashback
TiDB v6.4.0 引入了 [`FLASHBACK CLUSTER TO TIMESTAMP`](/sql-statements/sql-statement-flashback-to-timestamp.md) 语法,其功能是将集群的数据恢复到特定的时间点。为了方便脱离 TiDB 使用,tikv-ctl 提供了 `flashback` 命令。该命令支持在 TiKV 层面进行 Flashback 操作。
> **注意:**
>
> - 在执行 `flashback` 命令前,需要先通过 `./pd-ctl config set halt-scheduling true` 命令[停止 PD 调度](pd-control.md#config-show--set-option-value--placement-rules)
> - 该命令是用最新的时间戳写入特定时间点的旧数据,但不会删除当前数据,所以在使用前请确保集群有足够的存储空间来同时容纳旧数据和当前数据。
> - 该命令只支持本地模式。运行成功后,会打印 `flashback all stores success!`
下面示例将整个集群的数据恢复到 430315739761082369 时间点:
```shell
tikv-ctl --pd 127.0.0.1:2379 flashback --version 430315739761082369
```
输出结果如下:
```
flashback all stores success!
```
上述命令中各选项的含义如下:
- `--pd` 用于指定 PD 的访问地址。
- `--version` 用于指定 Flashback 目标的时间点。
- 默认情况下,该命令会对整个集群进行 Flashback。如果需要对指定 Region 或 key 范围进行操作,可以:
- 使用 `-r` 选项指定 Region,多个 Region 之间用 `,` 分隔。
- 使用 `--start` 和 `--end` 指定某个 key 范围内的所有 Region(默认无范围限制,采用 Hex 格式)。

@Oreoxmt Oreoxmt requested review from Oreoxmt and JmPotato June 7, 2023 03:34

> **注意:**
>
> - 在使用前,需要通过 `./pd-ctl config set halt-scheduling true` [停止 PD 调度](pd-control.md#config-show--set-option-value--placement-rules)。
Copy link
Member

Choose a reason for hiding this comment

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

先改成 code 调用吧,这样就不用加这个文档了

@Oreoxmt Oreoxmt added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR’s assignee is translating this PR. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. labels Jun 14, 2023
@ti-chi-bot ti-chi-bot bot added the missing-translation-status This PR does not have translation status info. label Jun 14, 2023
@Oreoxmt Oreoxmt added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. translation/doing This PR’s assignee is translating this PR. and removed missing-translation-status This PR does not have translation status info. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. labels Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. translation/doing This PR’s assignee is translating this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants