从 mysql 迁移数据(通过 TiDB DM)时遇到问题我在 mysql 中有一个表,其中有一个枚举列:
`xxx` enum('offer','payment') NOT NULL DEFAULT 'offer',
我创建了一个迁移任务,转储和加载进度都完成了,但是我在同步过程中遇到了这个错误:
"ErrCode": 10006,
"ErrClass": "database",
"ErrScope": "not-set",
"ErrLevel": "high",
"Message": "startLocation: [position: (, 0), gtid-set: ], endLocation: [position: (xxx-bin|000001.000035, 522223249), gtid-set: ]: execute statement failed: UPDATE `ti_xxx`.`api_logs` SET `l_id` = ?, `a_id` = ?, `l_datetime` = ?, `l_api` = ?, `l_request` = ?, `l_response_status` = ?, `l_response` = ?, `l_status` = ?, `l_currency` = ?, `l_type` = ?, `cl_id` = ?, `l_test` = ?, `l_parent_id` = ?, `l_attempt` = ?, `l_cl_type` = ?, `l_parameters` = ?, `l_api_type` = ?, `l_group_status` = ?, `l_group_attempt` = ? WHERE `l_id` = ? LIMIT 1",
"RawCause": "Error 1105: item 2 is not in enum [offer payment]",
"Workaround": ""
- TiDB 版本:5.7.25-TiDB-v5.2.0 TiDB 服务器
- DM版本:v2.0.6
- DM任务配置:
name: "xxx-api_logs"
task-mode: "all"
routes:
xxx:
schema-pattern: "xxx"
target-schema: "ti_xxx"
target-database:
host: "127.0.0.1"
port: 30306
user: "root"
password: "<removed>"
mysql-instances:
- source-id: "dba5-xxx"
block-allow-list: "xxx"
route-rules: ["xxx"]
block-allow-list:
xxx:
do-tables:
- db-name: "xxx"
tbl-name: "api_logs"
在 TiDB 方面,我用 enum 列测试了一些操作,它们有效:
mysql> CREATE TABLE t1 (
-> a enum('offer','payment') NOT NULL DEFAULT 'offer'
-> );
Query OK, 0 rows affected (0.27 sec)
mysql> INSERT INTO t1 VALUES ('payment');
Query OK, 1 row affected (0.03 sec)
mysql> INSERT INTO t1 VALUES (2);
Query OK, 1 row affected (0.00 sec)
mysql> select * from t1;
+---------+
| a |
+---------+
| payment |
| payment |
+---------+
2 rows in set (0.01 sec)
mysql> update t1 set a=1 where a=2;
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> select * from t1;
+-------+
| a |
+-------+
| offer |
| offer |
+-------+
2 rows in set (0.00 sec)
我使用了一个启用了中继的工作人员,我解析了中继日志,它包含一个有效的索引值
...
### @15=2
...
请建议我一些解决问题的方法,非常感谢