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