How to Skip Primary Key Conflicts in DM

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: DM 如何跳过主键冲突

| username: xingzhenxiang

[TiDB Usage Environment] Production Environment
[TiDB Version]
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachment: Screenshot/Logs/Monitoring]

| username: tidb菜鸟一只 | Original post link

Use the handle-error --binlog-pos command to skip.

| username: xingzhenxiang | Original post link

Are you using endLocation?

| username: tidb菜鸟一只 | Original post link

Use startLocation

| username: xingzhenxiang | Original post link

Is there a documentation link?

| username: tidb菜鸟一只 | Original post link

| username: xingzhenxiang | Original post link

My version is v6.5.1.

| username: Jjjjayson_zeng | Original post link

handle-error TaskName skip

| username: xingzhenxiang | Original post link

DM v7.0 is no longer supported.
image

| username: tidb菜鸟一只 | Original post link

Is this command no longer supported in version 6.5?

| username: xingzhenxiang | Original post link

The command help is gone.

| username: Jjjjayson_zeng | Original post link

6.5.1 should be supported. I upgraded to this version at that time. I haven’t used 7.0.

| username: tidb菜鸟一只 | Original post link

The binlog command manages and views binlog operations. The command is only supported in DM v6.0 and later versions; for earlier versions, you can use the handle-error command.
After version 6.0, use the binlog command.

| username: xingzhenxiang | Original post link

Reports must be accurate, only support DDL, and there is no detailed documentation.

| username: tidb菜鸟一只 | Original post link

binlog supports the following parameters:

  • -b, --binlog-pos:
    • Type: string.
    • Specifies the binlog position, indicating that the operation will take effect when the position matches the binlog event’s position. If not specified, DM will default to the binlog position of the current erroneous DDL statement.
    • Format: binlog-filename:binlog-pos, for example, mysql-bin|000001.000003:3270.
    • After a migration error occurs, the binlog position can be directly obtained from the position in the startLocation returned by query-status; before a migration error occurs, the binlog position can be obtained from the upstream MySQL using SHOW BINLOG EVENTS.

You need to specify -b with binlog-pos, otherwise, the default is the binlog-pos of the DDL error.

| username: Jjjjayson_zeng | Original post link

This command is useless.

| username: Jjjjayson_zeng | Original post link

You can’t find the binlog position.

| username: xingzhenxiang | Original post link

Where is the documentation? What does 000003 represent in mysql-bin|000001.000003:3270?

| username: xingzhenxiang | Original post link

startLocation: [position: (mysql-bin.001905, 1049412027)

| username: tidb菜鸟一只 | Original post link

Here

  • -b, --binlog-pos:
    • Type: string.
    • Specifies the binlog position, indicating that the operation will take effect when the position matches the binlog event’s position. If not specified, DM will default to the binlog position of the current failed DDL statement.
    • Format: binlog-filename:binlog-pos, for example, mysql-bin|000001.000003:3270.
    • After a migration error occurs, the binlog position can be directly obtained from the position in the startLocation returned by query-status; before a migration error occurs, the binlog position can be obtained from the upstream MySQL using SHOW BINLOG EVENTS.