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

zh,en: change sql to DDL for handle-error command (#516) #530

Merged
merged 4 commits into from
Dec 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion en/TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
- [Pause a Task](pause-task.md)
- [Resume a Task](resume-task.md)
- [Stop a Task](stop-task.md)
- [Handle Failed SQL Statements](handle-failed-sql-statements.md)
- [Handle Failed DDL Statements](handle-failed-ddl-statements.md)
- [Manually Handle Sharding DDL Locks](manually-handling-sharding-ddl-locks.md)
- [Manage Table Schema during Migration](manage-schema.md)
- [Handle Alerts](handle-alerts.md)
Expand Down
2 changes: 1 addition & 1 deletion en/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ summary: Learn about TiDB Data Migration documentation.

- [High availability of data migration tasks](overview.md#high-availability). The data migration task can run normally even when some DM-master or DM-worker nodes fail.
- [Sharding DDL support in the optimistic mode](feature-shard-merge-optimistic.md). In this mode, migration latency can be reduced in some scenarios and you can make A/B changes in the upstream database.
- Better usability, including the new [error handling mechanism](handle-failed-sql-statements.md) and the easier-to-read error messages and error handling suggestions.
- Better usability, including the new [error handling mechanism](handle-failed-ddl-statements.md) and the easier-to-read error messages and error handling suggestions.
- [TLS support](enable-tls.md) for connections between the upstream and the downstream, and for connections between DM components.
- Support for migrating data from MySQL 8.0 (experimental).

Expand Down
2 changes: 1 addition & 1 deletion en/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DM will attempt to split a single statement containing multiple DDL change opera

## How to handle incompatible DDL statements?

When you encounter a DDL statement unsupported by TiDB, you need to manually handle it using dmctl (skipping the DDL statement or replacing the DDL statement with a specified DDL statement). For details, see [Handle failed SQL statements](handle-failed-sql-statements.md).
When you encounter a DDL statement unsupported by TiDB, you need to manually handle it using dmctl (skipping the DDL statement or replacing the DDL statement with a specified DDL statement). For details, see [Handle failed DDL statements](handle-failed-ddl-statements.md).

> **Note:**
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
---
<<<<<<< HEAD:en/handle-failed-sql-statements.md
title: Handle Failed SQL Statements
summary: Learn how to handle failed SQL statements when you're using the TiDB Data Migration tool to migrate data.
=======
title: Handle Failed DDL Statements
summary: Learn how to handle failed DDL statements when you're using the TiDB Data Migration tool to migrate data.
aliases: ['/docs/tidb-data-migration/dev/skip-or-replace-abnormal-sql-statements/','/tidb-data-migration/dev/skip-or-replace-abnormal-sql-statements','/tidb-data-migration/dev/handle-failed-sql-statements']
CharLotteiu marked this conversation as resolved.
Show resolved Hide resolved
>>>>>>> 340e653... zh,en: change `sql` to `DDL` for handle-error command (#516):en/handle-failed-ddl-statements.md
---

# Handle Failed SQL Statements
# Handle Failed DDL Statements

This document introduces how to handle failed SQL statements when you're using the TiDB Data Migration (DM) tool to migrate data.
This document introduces how to handle failed DDL statements when you're using the TiDB Data Migration (DM) tool to migrate data.

Currently, TiDB is not completely compatible with all MySQL syntax (see [the DDL statements supported by TiDB](https://pingcap.com/docs/dev/reference/mysql-compatibility/#ddl)). Therefore, when DM is migrating data from MySQL to TiDB and TiDB does not support the corresponding SQL statement, an error might occur and break the migration process. In this case, you can use the `handle-error` command of DM to resume the migration.
Currently, TiDB is not completely compatible with all MySQL syntax (see [the DDL statements supported by TiDB](https://pingcap.com/docs/dev/reference/mysql-compatibility/#ddl)). Therefore, when DM is migrating data from MySQL to TiDB and TiDB does not support the corresponding DDL statement, an error might occur and break the migration process. In this case, you can use the `handle-error` command of DM to resume the migration.

## Restrictions

Expand All @@ -24,15 +30,15 @@ During the migration, the DDL statement unsupported by TiDB is executed in the u

## Command

When you use dmctl to manually handle the failed SQL statements, the commonly used commands include `query-status` and `handle-error`.
When you use dmctl to manually handle the failed DDL statements, the commonly used commands include `query-status` and `handle-error`.

### query-status

The `query-status` command is used to query the current status of items such as the subtask and the relay unit in each MySQL instance. For details, see [query status](query-status.md).

### handle-error

The `handle-error` command is used to handle the failed SQL statements.
The `handle-error` command is used to handle the failed DDL statements.

### Command usage

Expand Down Expand Up @@ -64,19 +70,19 @@ Global Flags:

+ `skip`: Skip the error

+ `replace`: Replace the failed SQL statement
+ `replace`: Replace the failed DDL statement

+ `revert`: Reset the previous skip/replace operation before the error occurs (only reset it when the previous skip/replace operation has not finally taken effect)

+ `binlog-pos`:
- Flag parameter, string, `--binlog-pos`
- If it is not specified, DM automatically handles the currently failed SQL statement.
- If it is not specified, DM automatically handles the currently failed DDL statement.
- If it is specified, the skip operation is executed when `binlog-pos` matches with the position of the binlog event. The format is `binlog-filename:binlog-pos`, for example, `mysql-bin|000001.000003:3270`.
- After the migration returns an error, the binlog position can be obtained from `position` in `startLocation` returned by `query-status`. Before the migration returns an error, the binlog position can be obtained by using [`SHOW BINLOG EVENTS`](https://dev.mysql.com/doc/refman/5.7/en/show-binlog-events.html) in the upstream MySQL instance.

## Usage examples

### Skip SQL if the migration gets interrupted
### Skip DDL if the migration gets interrupted

#### Non-shard-merge scenario

Expand Down Expand Up @@ -413,7 +419,7 @@ Assume that it is acceptable in the actual production environment that this DDL

You can see that the task runs normally with no error and all four wrong DDL statements are skipped.

### Replace SQL if the migration gets interrupted
### Replace DDL if the migration gets interrupted

#### Non-shard-merge scenario

Expand Down
2 changes: 1 addition & 1 deletion en/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ summary: Learn about the Data Migration tool, the architecture, the key componen

- [High availability of data migration task](#high-availability). The data migration task can run normally even when some DM-master or DM-worker nodes fail.
- [Sharding DDL support in the optimistic mode](feature-shard-merge-optimistic.md). In this mode, migration latency can be reduced in some scenarios and you can make A/B changes in the upstream database.
- Better usability, including the new [error handling mechanism](handle-failed-sql-statements.md) and the easier-to-read error messages and error handling suggestions.
- Better usability, including the new [error handling mechanism](handle-failed-ddl-statements.md) and the easier-to-read error messages and error handling suggestions.
- [TLS support](enable-tls.md) for connections between the upstream and the downstream, and for connections between DM components.
- Support for migrating data from MySQL 8.0 (experimental).

Expand Down
2 changes: 1 addition & 1 deletion zh/TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
- [暂停任务](pause-task.md)
- [恢复任务](resume-task.md)
- [停止任务](stop-task.md)
- [处理出错的 SQL 语句](handle-failed-sql-statements.md)
- [处理出错的 DDL 语句](handle-failed-ddl-statements.md)
- [手动处理 Sharding DDL Lock](manually-handling-sharding-ddl-locks.md)
- [管理迁移中表的表结构](manage-schema.md)
- [告警处理](handle-alerts.md)
Expand Down
2 changes: 1 addition & 1 deletion zh/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DM 2.0 相比于 1.0,主要有以下改进:

- [数据迁移任务的高可用](overview.md#高可用),部分 DM-master、DM-worker 节点异常后仍能保证数据迁移任务的正常运行。
- [乐观协调模式下的 sharding DDL](feature-shard-merge-optimistic.md) 可以在部分场景下减少 sharding DDL 同步过程中的延迟、支持上游数据库灰度变更等场景。
- 更好的易用性,包括新的[错误处理机制](handle-failed-sql-statements.md)及更清晰易读的错误信息与错误处理建议。
- 更好的易用性,包括新的[错误处理机制](handle-failed-ddl-statements.md)及更清晰易读的错误信息与错误处理建议。
- 与上下游数据库及 DM 各组件间连接的 [TLS 支持](enable-tls.md)。
- 实验性地支持从 MySQL 8.0 迁移数据。

Expand Down
2 changes: 1 addition & 1 deletion zh/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DM 会尝试将包含多个 DDL 变更操作的单条语句拆分成只包含一

## 如何处理不兼容的 DDL 语句?

你需要使用 dmctl 手动处理 TiDB 不兼容的 DDL 语句(包括手动跳过该 DDL 语句或使用用户指定的 DDL 语句替换原 DDL 语句,详见[处理出错的 SQL 语句](handle-failed-sql-statements.md))。
你需要使用 dmctl 手动处理 TiDB 不兼容的 DDL 语句(包括手动跳过该 DDL 语句或使用用户指定的 DDL 语句替换原 DDL 语句,详见[处理出错的 DDL 语句](handle-failed-ddl-statements.md))。

> **注意:**
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
---
<<<<<<< HEAD:zh/handle-failed-sql-statements.md
title: 处理出错的 SQL 语句
summary: 了解在使用 TiDB Data Migration 迁移数据时,如何处理出错的 SQL 语句。
=======
title: 处理出错的 DDL 语句
summary: 了解在使用 TiDB Data Migration 迁移数据时,如何处理出错的 DDL 语句。
aliases: ['/docs-cn/tidb-data-migration/dev/skip-or-replace-abnormal-sql-statements/','/zh/tidb-data-migration/dev/skip-or-replace-abnormal-sql-statements','/zh/tidb-data-migration/dev/handle-failed-sql-statements']
CharLotteiu marked this conversation as resolved.
Show resolved Hide resolved
>>>>>>> 340e653... zh,en: change `sql` to `DDL` for handle-error command (#516):zh/handle-failed-ddl-statements.md
---

# 处理出错的 SQL 语句
# 处理出错的 DDL 语句

本文介绍了如何使用 DM 来处理出错的 SQL 语句。
本文介绍了如何使用 DM 来处理出错的 DDL 语句。

目前,TiDB 并不完全兼容所有的 MySQL 语法(详见 [TiDB 已支持的 DDL 语句](https://pingcap.com/docs-cn/dev/reference/mysql-compatibility/#ddl))。当使用 DM 从 MySQL 迁移数据到 TiDB 时,如果 TiDB 不支持对应的 SQL 语句,可能会造成错误并中断迁移任务。在这种情况下,DM 提供 `handle-error` 命令来恢复迁移。
目前,TiDB 并不完全兼容所有的 MySQL 语法(详见 [TiDB 已支持的 DDL 语句](https://pingcap.com/docs-cn/dev/reference/mysql-compatibility/#ddl))。当使用 DM 从 MySQL 迁移数据到 TiDB 时,如果 TiDB 不支持对应的 DDL 语句,可能会造成错误并中断迁移任务。在这种情况下,DM 提供 `handle-error` 命令来恢复迁移。

## 使用限制

Expand All @@ -24,15 +30,15 @@ summary: 了解在使用 TiDB Data Migration 迁移数据时,如何处理出

## 命令介绍

使用 dmctl 手动处理出错的 SQL 语句时,主要使用的命令包括 `query-status`、`handle-error`。
使用 dmctl 手动处理出错的 DDL 语句时,主要使用的命令包括 `query-status`、`handle-error`。

### query-status

`query-status` 命令用于查询当前 MySQL 实例内子任务及 relay 单元等的状态和错误信息,详见[查询状态](query-status.md)。

### handle-error

`handle-error` 命令用于处理错误的 sql 语句。
`handle-error` 命令用于处理错误的 DDL 语句。

### 命令用法

Expand Down Expand Up @@ -70,7 +76,7 @@ Global Flags:

+ `binlog-pos`:
- flag 参数,string,`--binlog-pos`;
- 若不指定,DM 会自动处理当前出错的 SQL 语句
- 若不指定,DM 会自动处理当前出错的 DDL 语句
- 在指定时表示操作将在 `binlog-pos` 与 binlog event 的 position 匹配时生效,格式为 `binlog-filename:binlog-pos`,如 `mysql-bin|000001.000003:3270`。
- 在迁移执行出错后,binlog position 可直接从 `query-status` 返回的 `startLocation` 中的 `position` 获得;在迁移执行出错前,binlog position 可在上游 MySQL 中使用 [`SHOW BINLOG EVENTS`](https://dev.mysql.com/doc/refman/5.7/en/show-binlog-events.html) 获得。

Expand Down
2 changes: 1 addition & 1 deletion zh/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DM 2.0 相比于 1.0,主要有以下改进:

- [数据迁移任务的高可用](#高可用),部分 DM-master、DM-worker 节点异常后仍能保证数据迁移任务的正常运行。
- [乐观协调模式下的 sharding DDL](feature-shard-merge-optimistic.md) 可以在部分场景下减少 sharding DDL 同步过程中的延迟、支持上游数据库灰度变更等场景。
- 更好的易用性,包括新的[错误处理机制](handle-failed-sql-statements.md)及更清晰易读的错误信息与错误处理建议。
- 更好的易用性,包括新的[错误处理机制](handle-failed-ddl-statements.md)及更清晰易读的错误信息与错误处理建议。
- 与上下游数据库及 DM 各组件间连接的 [TLS 支持](enable-tls.md)。
- 实验性地支持从 MySQL 8.0 迁移数据。

Expand Down