DM 的 dmctl 中 sql-skip 使用
作者:TiDB 社区干货传送门
- 2022 年 7 月 11 日
本文字数:1875 字
阅读完需:约 6 分钟
作者: zhengyunpeng 原文来源:https://tidb.net/blog/41ba8223
sql-skip 有两种跳过错误的方式
1. 使用日志 position 方式跳过
2. 使用 SQL 语句方式跳过
示例如下
任务名为:tidb
1. 使用日志 position 方式
查询错误点 position
» query-error tidb
{
"result": true,
"msg": "",
"workers": [
{
"result": true,
"worker": "192.168.10.101:8262",
"msg": "",
"subTaskError": [
{
"name": "tidb",
"stage": "Running",
"unit": "Sync",
"sync": {
"errors": [
]
}
}
],
"RelayError": {
"msg": ""
}
},
{
"result": true,
"worker": "192.168.10.101:8263",
"msg": "",
"subTaskError": [
{
"name": "tidb",
"stage": "Paused",
"unit": "Sync",
"sync": {
"errors": [
{
"msg": "exec sqls[[ALTER TABLE `test`.`t_test `response_result` VARCHAR(2000) CHARACTER SET UTF8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '响应请求结果' AFTER `response_status`]] failed, err:Error 1105: unsupported modify column %!s(ast.ColumnOptionType=12)",
"failedBinlogPosition": "dbm1_3306-bin|000001.000003:58455056",
"errorSQL": "[ALTER TABLE `test`.`t_test` MODIFY COLUMN `response_result` VARCHAR(2000) CHARACTER SET UTF8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '响应请求结果' AFTER `response_status`]"
}
]
}
}
],
"RelayError": {
"msg": ""
}
}
]
}
复制代码
使用获取到的 failedBinlogPosition:
» sql-skip -w 192.168.10.101:8263 -b dbm1_3306-bin|000001.000003:58455056 tidb
{
"result": true,
"msg": "",
"workers": [
{
"result": true,
"worker": "",
"msg": ""
}
]
}
复制代码
重新唤起任务执行:
» resume-task -w 192.168.10.101:8263 tidb
{
"op": "Resume",
"result": true,
"msg": "",
"workers": [
{
"meta": {
"result": true,
"worker": "192.168.10.101:8263",
"msg": ""
},
"op": "Resume",
"logID": "45"
}
]
}
复制代码
2. 使用 SQL 方式
» sql-skip -w 192.168.10.101:8263 -s "~(ALTERs+TABLEs+`h3-warehouse`.`t_warehouse_warerecall`).*" tidb
{
"result": true,
"msg": "",
"workers": [
{
"result": true,
"worker": "",
"msg": ""
}
]
}
复制代码
重新唤起任务执行:
» resume-task -w 192.168.10.101:8263 tidb
{
"op": "Resume",
"result": true,
"msg": "",
"workers": [
{
"meta": {
"result": true,
"worker": "192.168.10.101:8263",
"msg": ""
},
"op": "Resume",
"logID": "51"
}
]
}
复制代码
sql 跳过支持正则表达式方式,SQL 中的空格必须使用 s 替换。
SQL pattern used to match the DDL converted by optional router-rules if matched the sql-skip operation will be applied. The format like "~(?i)ALTERs+TABLEs+db1.`tbl1`s+ADDs+COLUMNs+col1s+INT". Whitespace is not supported, and must be replaced by "s". Staring with ~ as regular expression. This can only be used for DDL (converted by optional router-rules), and if multi DDLs in one binlog event, one of them matched is enough, but all of them will be skipped
复制代码
划线
评论
复制
发布于: 刚刚阅读数: 3
版权声明: 本文为 InfoQ 作者【TiDB 社区干货传送门】的原创文章。
原文链接:【http://xie.infoq.cn/article/4cef3e84b51f3fe5ae833ab67】。文章转载请联系作者。
TiDB 社区干货传送门
关注
TiDB 社区官网:https://tidb.net/ 2021.12.15 加入
TiDB 社区干货传送门是由 TiDB 社区中布道师组委会自发组织的 TiDB 社区优质内容对外宣布的栏目,旨在加深 TiDBer 之间的交流和学习。一起构建有爱、互助、共创共建的 TiDB 社区 https://tidb.net/
评论