Description
Description
When the schema name, table name or column name has Keyword or Special characters, the job goes dead.
Steps to reproduce the issue:
example (1)
1、prepare schema name with Special characters
CREATE DATABASE `#$%^&***^%()`;
2、create Instance job job_1.json.txt
3、job dead: View log_1
example (2)
1、create Instance job
job_1.json.txt
2、prepare table name with Keyword and Special characters ;
create database test1;
CREATE TABLE `^^&&*(()shfds` ( `key` varchar(50) DEFAULT NULL, `message` text , `666622**@#~` int(2) DEFAULT '0' , `id` int(3) NOT NULL, PRIMARY KEY (`id`));
3、job dead:View log_2
example (3)
1、create Instance job job_1.json.txt
2、prepare schema name with Keyword
CREATE DATABASE `update`;
3、job dead: View log_3
example (4)
1、prepare data
CREATE DATABASE test1;
use test1;
CREATE TABLE `^^&&*(()shfds` ( `key` varchar(50) DEFAULT NULL, `message` text , `666622**@#~` int(2) DEFAULT '0' , `id` int(3) NOT NULL, PRIMARY KEY (`id`));
2、create job
job_2.json.txt
3、dtle 'panic': View log_4
example (5)
1、prepare data
CREATE DATABASE #$%^&***^%()
;
2、create job
job_3.json.txt
3、job dead:View log_5
Describe the results you received:
job dead or dtle 'panic'
Describe the results you expected:
job running
Output of ./dtle version
:
Dtle 9.9.9.9 (git: master cc0b8762797cf55fe86b7a8ec7c26b087c7ca0b9)
Additional information you deem important (e.g. issue happens only occasionally):
when delete the dead job dtle ‘panic’
Additional details (log, config, job config etc):
1、 log_1
2019/08/01 16:23:21.255191 [INFO] [jobid:fc9c30b9-cd0a-42b3-204b-0d3f6bdc29e8] mysql.extractor: Step 2: read list of available tables in each database
2019/08/01 16:23:21.256036 [INFO] [jobid:fc9c30b9-cd0a-42b3-204b-0d3f6bdc29e8] mysql.extractor: Step 2: committing transaction
2019/08/01 16:23:21.256291 [ERR] [jobid:fc9c30b9-cd0a-42b3-204b-0d3f6bdc29e8] mysql.extractor. error: Error 1064: You have an error in your SQL syntax; check the man
ual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
2019/08/01 16:23:21.256468 [DEBUG] setState 4
2019/08/01 16:23:21.256497 [DEBUG] setState.SaveState
2019/08/01 16:23:21.256558 [INFO] [jobid:fc9c30b9-cd0a-42b3-204b-0d3f6bdc29e8] mysql.extractor: Shutting down
2019/08/01 16:23:21.256663 [DEBUG] Worker.SaveState: lock: 0xc000cb1ab0, 0xc00098d9c0
2019/08/01 16:23:21.256675 [DEBUG] Worker.SaveState: after lock: 0xc000cb1ab0
2019/08/01 16:23:21.256684 [DEBUG] Worker.SaveState: after unlock: 0xc000cb1ab0
2019/08/01 16:23:21.256692 [DEBUG] updater
2019/08/01 16:23:21.256725 [ERR] agent: Task "Src" for alloc "a199ddb3-a646-c876-2cc0-716e5c8bc0dd" failed: Wait returned exit code 2, and error Error 1064: You have
an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
2019/08/01 16:23:21.256758 [INFO] agent: Not restarting t
2、log_2
2019/08/01 16:46:30.545699 [ERR] agent: Task "Dest" for alloc "96d26e71-fe17-73af-13a3-c999fff651e7" failed: Wait returned exit code 2, and error Error 1046: No data
base selected
2019/08/01 16:46:30.545749 [INFO] agent: Not restarting task: Dest for alloc: 96d26e71-fe17-73af-13a3-c999fff651e7
2019/08/01 16:46:30.545756 [DEBUG] setState restart 1
2019/08/01 16:46:30.545759 [DEBUG] Client.allocSync: <-allocUpdates
2019/08/01 16:46:30.545764 [DEBUG] setState.SaveState
2019/08/01 16:46:30.545836 [DEBUG] syncStatus: updater
2019/08/01 16:46:30.545848 [DEBUG] Client.updateAllocStatus: TaskStates: map[Src:0xc000bcd500]
2019/08/01 16:46:30.545857 [DEBUG] Client.allocSync: <-allocUpdates
2019/08/01 16:46:30.545897 [DEBUG] Worker.SaveState: lock: 0xc000d23960, 0xc000caf300
2019/08/01 16:46:30.545906 [DEBUG] Worker.SaveState: after lock: 0xc000d23960
2019/08/01 16:46:30.545917 [DEBUG] Worker.SaveState: after unlock: 0xc000d23960
2019/08/01 16:46:30.545924 [DEBUG] updater
2019/08/01 16:46:30.545935 [DEBUG] setTaskState: dirtyCh<-
2019/08/01 16:46:30.545942 [DEBUG] setState 9
2019/08/01 16:46:30.545949 [DEBUG] setState.SaveState
2019/08/01 16:46:30.546022 [DEBUG] Worker.SaveState: lock: 0xc000d23960, 0xc000caf300
2019/08/01 16:46:30.546029 [DEBUG] Worker.SaveState: after lock: 0xc000d23960
2019/08/01 16:46:30.546037 [DEBUG] Worker.SaveState: after unlock: 0xc000d23960
2019/08/01 16:46:30.546044 [DEBUG] updater
2019/08/01 16:46:30.546051 [DEBUG] setTaskState: dirtyCh<-
2019/08/01 16:46:30.546030 [DEBUG] syncStatus: Alloc
2019/08/01 16:46:30.546149 [DEBUG] syncStatus: updater
2019/08/01 16:46:30.546160 [DEBUG] Client.updateAllocStatus: TaskStates: map[Dest:0xc000a47a40]
2019/08/01 16:46:30.546173 [DEBUG] syncStatus: Alloc
2019/08/01 16:46:30.546181 [DEBUG] Client.allocSync: <-allocUpdates
2019/08/01 16:46:30.546225 [DEBUG] syncStatus: updater
2019/08/01 16:46:30.546235 [DEBUG] Client.updateAllocStatus: TaskStates: map[Dest:0xc000a47ec0]
2019/08/01 16:46:30.546247 [DEBUG] Client.allocSync: <-allocUpdates
2019/08/01 16:46:30.643798 [DEBUG] [jobid:2554752b-45d9-f8c3-c5b0-0b778a5a9838] extractor. StreamEvents goroutine exited
2019/08/01 16:46:30.645108 [DEBUG] Client.allocSync: len(aUpdates) != 0
2019/08/01 16:46:30.645735 [ERR] [jobid:2554752b-45d9-f8c3-c5b0-0b778a5a9838] mysql.reader error GetEvent. err: Sync was closed
2019/08/01 16:46:30.645931 [INFO] [jobid:2554752b-45d9-f8c3-c5b0-0b778a5a9838] mysql.extractor: Shutting down
3、log_3
2019/08/01 16:50:35.683104 [DEBUG] setTaskState: dirtyCh<-
2019/08/01 16:50:35.683125 [DEBUG] syncStatus: Alloc
2019/08/01 16:50:35.683239 [DEBUG] syncStatus: updater
2019/08/01 16:50:35.683254 [DEBUG] Client.updateAllocStatus: TaskStates: map[Dest:0xc000a3c720]
2019/08/01 16:50:35.683287 [DEBUG] Client.allocSync: <-allocUpdates
2019/08/01 16:50:35.780624 [DEBUG] [jobid:19af81f7-4238-8390-ffc3-140a267fd887] extractor. StreamEvents goroutine exited
2019/08/01 16:50:35.781977 [ERR] [jobid:19af81f7-4238-8390-ffc3-140a267fd887] mysql.reader error GetEvent. err: Sync was closed
2019/08/01 16:50:35.782299 [INFO] [jobid:19af81f7-4238-8390-ffc3-140a267fd887] mysql.extractor: Shutting down
2019/08/01 16:50:35.845148 [DEBUG] Client.allocSync: len(aUpdates) != 0
2019/08/01 16:50:35.897603 [DEBUG] agent: Updated allocations at index 854 (total 2) (pulled 0) (filtered 2)
2019/08/01 16:50:35.897668 [DEBUG] watchAllocations: update
4、log_4
[root@node4 /]# panic: regexp: Compile(`^&&*(()shfds`): error parsing regexp: missing closing ): `^&&*(()shfds`
goroutine 710 [running]:
regexp.MustCompile(0xc00094ca01, 0xc, 0xc00094ca00)
/opt/go/src/regexp/regexp.go:245 +0x171
github.com/actiontech/dtle/internal/client/driver/mysql/binlog.(*BinlogReader).genRegexMap(0xc0004aef00)
/universe/src/github.com/actiontech/dtle/internal/client/driver/mysql/binlog/binlog_reader.go:1448 +0x1e8
github.com/actiontech/dtle/internal/client/driver/mysql/binlog.NewMySQLReader(0xc00046c840, 0xc0004ab3b0, 0xc00000e410, 0x1, 0x1, 0xc000838fe0, 0x2540be400, 0xc0004aa230, 0x0)
/universe/src/github.com/actiontech/dtle/internal/client/driver/mysql/binlog/binlog_reader.go:188 +0x5f4
github.com/actiontech/dtle/internal/client/driver/mysql.(*Extractor).initBinlogReader(0xc0001f8240, 0xc0009c3890, 0x32, 0x0)
/universe/src/github.com/actiontech/dtle/internal/client/driver/mysql/extractor.go:621 +0x73
github.com/actiontech/dtle/internal/client/driver/mysql.(*Extractor).Run(0xc0001f8240)
/universe/src/github.com/actiontech/dtle/internal/client/driver/mysql/extractor.go:256 +0x46a
created by github.com/actiontech/dtle/internal/client/driver.(*MySQLDriver).Start
/universe/src/github.com/actiontech/dtle/internal/client/driver/mysql.go:240 +0x406
5、
2019/08/01 17:17:31.247325 [INFO] [jobid:fd801245-663a-7d55-6787-ae9635ebb3b8] mysql.extractor: Step 2: read list of available tables in each database
2019/08/01 17:17:31.247485 [INFO] [jobid:fd801245-663a-7d55-6787-ae9635ebb3b8] mysql.extractor: Step 2: committing transaction
2019/08/01 17:17:31.247868 [ERR] [jobid:fd801245-663a-7d55-6787-ae9635ebb3b8] mysql.extractor. error: Error 1064: You have an error in your SQL syntax; check the man
ual that corresponds to your MySQL server version for the right syntax to use near '^^&&*(()shfds' at line 1
2019/08/01 17:17:31.248038 [INFO] [jobid:fd801245-663a-7d55-6787-ae9635ebb3b8] mysql.extractor: Shutting down
2019/08/01 17:17:31.248074 [DEBUG] setState 4
2019/08/01 17:17:31.248088 [DEBUG] setState.SaveState
2019/08/01 17:17:31.248282 [DEBUG] Worker.SaveState: lock: 0xc00038ebd0, 0xc00099aea0
2019/08/01 17:17:31.248297 [DEBUG] Worker.SaveState: after lock: 0xc00038ebd0
2019/08/01 17:17:31.248309 [DEBUG] Worker.SaveState: after unlock: 0xc00038ebd0
2019/08/01 17:17:31.248322 [DEBUG] updater
2019/08/01 17:17:31.248364 [ERR] agent: Task "Src" for alloc "8bf107ec-f81a-e173-5be8-93f88527f5b2" failed: Wait returned exit code 2, and error Error 1064: You have
an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '^^&&*(()shfds' at line 1
2019/08/01 17:17:31.248382 [INFO] agent: Not restarting task: Src for alloc: 8bf107ec-f81a-e173-5be8-93f88527f5b2
2019/08/01 17:17:31.248393 [DEBUG] setState restart 1