Skip to content

Conversation

@fengou1
Copy link
Contributor

@fengou1 fengou1 commented Mar 14, 2022

First-time contributors' checklist

What is changed, added or deleted? (Required)

Added a new document for introducing new features in BR. (br/br-freatures.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 (in Chinese).

  • master (the latest development version)
  • v6.0 (TiDB 6.0 versions)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 versions)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

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

  • This PR is translated from:
  • Other reference link(s):

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

Copy link
Contributor

@en-jin19 en-jin19 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 24, 2022
@fengou1
Copy link
Contributor Author

fengou1 commented Mar 25, 2022

LGTM

Co-authored-by: Enwei <jinenwei@pingcap.com>
@en-jin19
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

@en-jin19: /merge in this pull request requires 2 approval(s).

Details

In response to this:

/merge

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 ti-community-infra/tichi repository.

@en-jin19
Copy link
Contributor

/remove-status LGT1
/status LGT2

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 25, 2022
@en-jin19
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

DetailsCommit hash: a26eb3e

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 25, 2022
@ti-chi-bot ti-chi-bot merged commit 62e562e into pingcap:master Mar 25, 2022

使用 Backup & Restore (BR) 执行数据恢复任务时,BR 会先在下游 TiDB 集群创建库和表,再进行数据恢复。TiDB v6.0 之前,在数据恢复阶段创建表时,BR 采用了[串行执行](#实现原理)的方案。然而,当需要恢复的数据中带有大量的表(约 50000 张)时,该方案会在创建表上消耗较多时间。

为了通过加快创建表的速度和减少数据恢复的时间,从 TiDB v6.0 起,BR 引入了批量建表功能,此功能默认开启。
Copy link
Contributor

@en-jin19 en-jin19 Mar 29, 2022

Choose a reason for hiding this comment

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

为了加快创建表的速度【,以】减少数据恢复的时间,【TiDB 在 v6.0.0 中引入了 BR 】批量建表功能,此功能默认开启。


# BR 批量建表

使用 Backup & Restore (BR) 执行数据恢复任务时,BR 会先在下游 TiDB 集群创建库和表,再进行数据恢复。TiDB v6.0 之前,在数据恢复阶段创建表时,BR 采用了[串行执行](#实现原理)的方案。然而,当需要恢复的数据中带有大量的表(约 50000 张)时,该方案会在创建表上消耗较多时间。
Copy link
Contributor

@en-jin19 en-jin19 Mar 29, 2022

Choose a reason for hiding this comment

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

为了与第 39 行保持一致,第一句可修改为以下内容(确定所有修改内容后,会提 PR 进行修改):

使用 Backup & Restore (BR) 执行数据恢复任务时,BR 会先在【目标 TiDB 集群上】创建库和表,再进行数据恢复。


## 实现原理

- v6.0 前的串行建表方案:在 v6.0 之前的版本,BR 采用了串行建表方案。在使用 BR 执行数据恢复任务时,BR 会先在目标 TiDB 创建库和表后,再开始进行数据恢复。建表时,BR 会在调用 TiDB 接口后,使用 SQL 语句 `Create Table` 创建表。建表任务由 TiDB DDL owner 依次串行执行。在每张表被创建时,各会引起一次 schema 版本的变更,而每次的 schema 版本的变更都需要同步到其他 BR 和其他 TiDB DDL worker。因此,当需要创建的表的数量比较多时,串行建表方案会导致建表时间过长。
Copy link
Contributor

@en-jin19 en-jin19 Mar 29, 2022

Choose a reason for hiding this comment

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

  • v6.0 前的串行建表方案:在 v6.0 之前的版本,BR 采用了串行建表方案。在使用 BR 执行数据恢复任务时,BR 会先在目标 TiDB 集群创建库和表后,再开始进行数据恢复。建表时,BR 会在调用 TiDB 内部接口后,使用 SQL 语句 Create Table 创建表。建表任务由 TiDB DDL owner 依次串行执行。在每张表被创建时,各会引起一次 DDL schema 版本的变更,而每次的 schema 版本的变更都需要同步到其他 TiDB DDL worker(含 BR)。因此,当需要创建的表的数量比较多时,串行建表方案会导致建表时间过长。

@en-jin19 en-jin19 added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed status/PTAL This PR is ready for reviewing. translation/doing This PR’s assignee is translating this PR. labels Mar 29, 2022
## 实现原理

- v6.0 前的串行建表方案:在 v6.0 之前的版本,BR 采用了串行建表方案。在使用 BR 执行数据恢复任务时,BR 会先在目标 TiDB 创建库和表后,再开始进行数据恢复。建表时,BR 会在调用 TiDB 接口后,使用 SQL 语句 `Create Table` 创建表。建表任务由 TiDB DDL owner 依次串行执行。在每张表被创建时,各会引起一次 schema 版本的变更,而每次的 schema 版本的变更都需要同步到其他 BR 和其他 TiDB DDL worker。因此,当需要创建的表的数量比较多时,串行建表方案会导致建表时间过长。
- v6.0 起的批量建表方案:批量建表功能采用了并发批量建表方案。从 v6.0 起,在默认情况下,BR 会以 128 张表为一批,并发创建多批表。采用该方案后,BR 每建一批表时,TiDB schema 版本只会变更一次。此方法极大地提高了建表速度。
Copy link
Contributor

Choose a reason for hiding this comment

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

  • v6.0 起的批量建表方案:从 v6.0 起,在默认情况下,BR 会以 128 张表为一批,并发创建多批表。采用该方案后,BR 每建一批表时,TiDB schema 版本只会变更一次。此方法极大地提高了建表速度。

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

Labels

area/br Indicates that the Issue or PR belongs to the area of BR (Backup & Restore). size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. v6.0 This PR/issue applies to TiDB v6.0.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants