DM同步MySQL数据到TiDB时报错

【 TiDB 使用环境】生产环境
【 TiDB 版本】7.5.4

使用dm同步阿里云RDS 数据到 TiDB 7.5.3版本时,Dump 和 Load 阶段都没有报错,但是在Sync阶段报错,具体报错信息如下

$ tiup dmctl --master-addr 192.168.3.156:8261 query-status rds-to-tidb-for-shopdb
tiup is checking updates for component dmctl ...
A new version of dmctl is available:
   The latest version:         v8.4.0
   Local installed version:    v8.2.0
   Update current component:   tiup update dmctl
   Update all components:      tiup update --all

Starting component `dmctl`: /home/tidb/.tiup/components/dmctl/v8.2.0/dmctl/dmctl --master-addr 192.168.3.156:8261 query-status rds-to-tidb-for-shopdb
{
    "result": true,
    "msg": "",
    "sources": [
        {
            "result": true,
            "msg": "",
            "sourceStatus": {
                "source": "rds-shopdb",
                "worker": "dm-192.168.3.153-8262",
                "result": null,
                "relayStatus": {
                    "masterBinlog": "(mysql-bin.002619, 11239063)",
                    "masterBinlogGtid": "11d06196-a8b8-11eb-afec-0c42a1121b4c:1-103942405,406f2881-ac8f-11ed-8993-043f72a0fbbe:1-38591245,cd058783-aa96-11ec-a8bf-0c42a1df22ac:1-113402275",
                    "relaySubDir": "406f2881-ac8f-11ed-8993-043f72a0fbbe.000001",
                    "relayBinlog": "(mysql-bin.002619, 11239063)",
                    "relayBinlogGtid": "11d06196-a8b8-11eb-afec-0c42a1121b4c:1-103942405,406f2881-ac8f-11ed-8993-043f72a0fbbe:1-38591245,cd058783-aa96-11ec-a8bf-0c42a1df22ac:1-113402275",
                    "relayCatchUpMaster": true,
                    "stage": "Running",
                    "result": null
                }
            },
            "subTaskStatus": [
                {
                    "name": "rds-to-tidb-for-shopdb",
                    "stage": "Paused",
                    "unit": "Sync",
                    "result": {
                        "isCanceled": false,
                        "errors": [
                            {
                                "ErrCode": 36067,
                                "ErrClass": "sync-unit",
                                "ErrScope": "internal",
                                "ErrLevel": "high",
                                "Message": "startLocation: [position: (mysql-bin|000001.002618, 34650758), gtid-set: 11d06196-a8b8-11eb-afec-0c42a1121b4c:1-103942405,406f2881-ac8f-11ed-8993-043f72a0fbbe:1-38536938,cd058783-aa96-11ec-a8bf-0c42a1df22ac:1-113402275], endLocation: [position: (mysql-bin|000001.002618, 34650962), gtid-set: 11d06196-a8b8-11eb-afec-0c42a1121b4c:1-103942405,406f2881-ac8f-11ed-8993-043f72a0fbbe:1-38536939,cd058783-aa96-11ec-a8bf-0c42a1df22ac:1-113402275], origin SQL: [XA START X'3137322e31372e3131362e3134372e746d313733323837343431383338343030303730',X'3137322e31372e3131362e3134372e746d313339',1096044365]: parse DDL: XA START X'3137322e31372e3131362e3134372e746d313733323837343431383338343030303730',X'3137322e31372e3131362e3134372e746d313339',1096044365",
                                "RawCause": "line 1 column 2 near \"XA START X'3137322e31372e3131362e3134372e746d313733323837343431383338343030303730',X'3137322e31372e3131362e3134372e746d313339',1096044365\" ",
                                "Workaround": "Please confirm your DDL statement is correct and needed. For TiDB compatible DDL, see https://docs.pingcap.com/tidb/stable/mysql-compatibility#ddl. You can use `handle-error` command to skip or replace the DDL or add a binlog filter rule to ignore it if the DDL is not needed."
                            }
                        ],
                        "detail": null
                    },
                    "unresolvedDDLLockID": "",
                    "sync": {
                        "totalEvents": "2018",
                        "totalTps": "67",
                        "recentTps": "0",
                        "masterBinlog": "(mysql-bin.002619, 11239063)",
                        "masterBinlogGtid": "11d06196-a8b8-11eb-afec-0c42a1121b4c:1-103942405,406f2881-ac8f-11ed-8993-043f72a0fbbe:1-38591245,cd058783-aa96-11ec-a8bf-0c42a1df22ac:1-113402275",
                        "syncerBinlog": "(mysql-bin|000001.002618, 34650693)",
                        "syncerBinlogGtid": "11d06196-a8b8-11eb-afec-0c42a1121b4c:1-103942405,406f2881-ac8f-11ed-8993-043f72a0fbbe:1-38536938,cd058783-aa96-11ec-a8bf-0c42a1df22ac:1-113402275",
                        "blockingDDLs": [
                        ],
                        "unresolvedGroups": [
                        ],
                        "synced": false,
                        "binlogType": "local",
                        "secondsBehindMaster": "0",
                        "blockDDLOwner": "",
                        "conflictMsg": "",
                        "totalRows": "2018",
                        "totalRps": "67",
                        "recentRps": "0"
                    },
                    "validation": null
                }
            ]
        }
    ]
}

这个错信息 XA START X’3137322e31372e3131362e3134372e746d313733323837343431383338343030303730’,X’3137322e31372e3131362e3134372e746d313339’,1096044365 是MySQL的 分布式事务

看TiDB官网文档, 有个信息


是直接不支持XA 事务么

这个有没有其他办法呢?

从业务上看确实需要分布式事务支持嘛?

如果不需要,是否可以通过 innodb_support_xa 参数关闭这个功能。

检查应用代码,避免使用XA事务,或者将XA事务替换为本地事务。如果业务逻辑允许,这是最推荐的解决方案,如果您无法修改应用代码,可以考虑在DM中使用binlog过滤规则来忽略这些XA事务相关的命令。这可以通过添加binlog filter规则来实现,使得这些命令不会被同步到TiDB,看了下当前的tidb 8.4仍旧是不支持xa语法的