forked from pingcap/dm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an automated cherry-pick of pingcap#1869
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
- Loading branch information
1 parent
a91b47c
commit 1966a72
Showing
17 changed files
with
388 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# diff Configuration. | ||
|
||
log-level = "info" | ||
|
||
chunk-size = 20 | ||
|
||
check-thread-count = 4 | ||
|
||
sample-percent = 100 | ||
|
||
use-checksum = true | ||
|
||
fix-sql-file = "fix.sql" | ||
|
||
# tables need to check. | ||
[[check-tables]] | ||
schema = "sql_mode" | ||
tables = ["~.*"] | ||
|
||
[[source-db]] | ||
host = "127.0.0.1" | ||
port = 3306 | ||
user = "root" | ||
password = "123456" | ||
instance-id = "source-1" | ||
|
||
[[table-config]] | ||
schema = "sql_mode" | ||
table = "t_1" | ||
|
||
[[table-config.source-tables]] | ||
instance-id = "source-1" | ||
schema = "sql_mode" | ||
table = "t_1" | ||
|
||
[[source-db]] | ||
host = "127.0.0.1" | ||
port = 3307 | ||
user = "root" | ||
password = "123456" | ||
instance-id = "source-2" | ||
|
||
[[table-config]] | ||
schema = "sql_mode" | ||
table = "t_2" | ||
|
||
[[table-config.source-tables]] | ||
instance-id = "source-2" | ||
schema = "sql_mode" | ||
table = "t_2" | ||
|
||
[target-db] | ||
host = "127.0.0.1" | ||
port = 4000 | ||
user = "test" | ||
password = "123456" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Master Configuration. | ||
master-addr = ":8261" | ||
advertise-addr = "127.0.0.1:8261" | ||
auto-compaction-retention = "3s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
name: sql_mode | ||
task-mode: all | ||
is-sharding: false | ||
meta-schema: "dm_meta" | ||
enable-heartbeat: false | ||
|
||
target-database: | ||
host: "127.0.0.1" | ||
port: 4000 | ||
user: "root" | ||
password: "" | ||
|
||
mysql-instances: | ||
- source-id: "mysql-replica-01" | ||
block-allow-list: "instance" | ||
mydumper-config-name: "global" | ||
loader-config-name: "global" | ||
syncer-config-name: "global" | ||
|
||
- source-id: "mysql-replica-02" | ||
block-allow-list: "instance" | ||
mydumper-config-name: "global" | ||
loader-config-name: "global" | ||
syncer-config-name: "global" | ||
|
||
block-allow-list: | ||
instance: | ||
do-dbs: ["sql_mode"] | ||
|
||
mydumpers: | ||
global: | ||
threads: 4 | ||
chunk-filesize: 0 | ||
skip-tz-utc: true | ||
extra-args: "--statement-size=4000" | ||
|
||
loaders: | ||
global: | ||
pool-size: 16 | ||
dir: "./dumped_data" | ||
|
||
syncers: | ||
global: | ||
worker-count: 16 | ||
batch: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name = "worker1" | ||
join = "127.0.0.1:8261" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name = "worker2" | ||
join = "127.0.0.1:8261" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source-id: mysql-replica-01 | ||
flavor: '' | ||
enable-gtid: false | ||
enable-relay: true | ||
relay-binlog-name: '' | ||
relay-binlog-gtid: '' | ||
from: | ||
host: 127.0.0.1 | ||
user: root | ||
password: /Q7B9DizNLLTTfiZHv9WoEAKamfpIUs= | ||
port: 3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source-id: mysql-replica-02 | ||
flavor: '' | ||
enable-gtid: false | ||
enable-relay: true | ||
relay-binlog-name: '' | ||
relay-binlog-gtid: '' | ||
from: | ||
host: 127.0.0.1 | ||
user: root | ||
password: /Q7B9DizNLLTTfiZHv9WoEAKamfpIUs= | ||
port: 3307 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
set @@session.SQL_MODE=''; | ||
use `sql_mode`; | ||
|
||
-- test sql_mode PIPES_AS_CONCAT | ||
insert into t_1(num) values('pipes'||'as'||'concat'); | ||
|
||
-- test sql_mode ANSI_QUOTES | ||
insert into t_1(name) values("a"); | ||
|
||
-- test sql_mode IGNORE_SPACE | ||
create table sum (id int not null, primary key(id)); | ||
|
||
-- test sql_mode NO_AUTO_VALUE_ON_ZERO | ||
insert into t_1(id, name) values (30, 'a'); | ||
insert into t_1(id, name) values (0, 'b'); | ||
insert into t_1(id, name) values (0, 'c'); | ||
|
||
-- test sql_mode NO_BACKSLASH_ESCAPES | ||
insert into t_1(name) values ('\\b'); | ||
|
||
-- test sql_mode STRICT_TRANS_TABLES && STRICT_ALL_TABLES && NO_ZERO_IN_DATE && NO_ZERO_DATE && ALLOW_INVALID_DATES | ||
insert into t_1(dt) values('0000-06-00'); | ||
insert into t_1(dt) values('0000-00-01'); | ||
insert into t_1(dt) values('0000-06-01'); | ||
insert into t_1(dt) values('0000-00-00'); | ||
|
||
-- test sql_mode ERROR_FOR_DIVISION_BY_ZERO | ||
insert into t_1(num) values(4/0); | ||
|
||
-- test sql_mode NO_AUTO_CREATE_USER | ||
drop user if exists 'no_auto_create_user'; | ||
grant select on *.* to 'no_auto_create_user'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
set @@session.SQL_MODE=''; | ||
|
||
drop database if exists `sql_mode`; | ||
create database `sql_mode`; | ||
use `sql_mode`; | ||
CREATE TABLE `t_1` ( | ||
`id` int NOT NULL AUTO_INCREMENT, | ||
`name` varchar(60), | ||
`num` int, | ||
`dt` datetime, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
-- test sql_mode PIPES_AS_CONCAT | ||
insert into t_1(num) values('pipes'||'as'||'concat'); | ||
|
||
-- test sql_mode ANSI_QUOTES | ||
insert into t_1(name) values("a"); | ||
|
||
-- test sql_mode IGNORE_SPACE | ||
create table count (id int not null, primary key(id)); | ||
|
||
-- test sql_mode NO_AUTO_VALUE_ON_ZERO | ||
insert into t_1(id, name) values (10, 'a'); | ||
insert into t_1(id, name) values (0, 'b'); | ||
insert into t_1(id, name) values (0, 'c'); | ||
|
||
-- test sql_mode NO_BACKSLASH_ESCAPES | ||
insert into t_1(name) values ('\\a'); | ||
|
||
-- test sql_mode STRICT_TRANS_TABLES && STRICT_ALL_TABLES && NO_ZERO_IN_DATE && NO_ZERO_DATE && ALLOW_INVALID_DATES | ||
insert into t_1(dt) values('0000-06-00'); | ||
insert into t_1(dt) values('0000-00-01'); | ||
insert into t_1(dt) values('0000-06-01'); | ||
insert into t_1(dt) values('0000-00-00'); | ||
|
||
-- test sql_mode ERROR_FOR_DIVISION_BY_ZERO | ||
insert into t_1(num) values(4/0); | ||
|
||
-- test sql_mode NO_AUTO_CREATE_USER | ||
drop user if exists 'no_auto_create_user'; | ||
grant select on *.* to 'no_auto_create_user'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
set @@session.sql_mode='ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,REAL_AS_FLOAT'; | ||
-- NO_AUTO_CREATE_USER set failed in mysql8.0 | ||
|
||
use sql_mode; | ||
|
||
-- test sql_mode PIPES_AS_CONCAT | ||
set @@session.sql_mode=concat(@@session.sql_mode, ',PIPES_AS_CONCAT'); | ||
insert into t_2(name) values('pipes'||'as'||'concat'); | ||
|
||
-- test sql_mode ANSI_QUOTES | ||
insert into t_2(name) values("a"); | ||
|
||
-- test sql_mode IGNORE_SPACE | ||
set @@session.sql_mode=concat(@@session.sql_mode, ',IGNORE_SPACE'); | ||
insert into t_2(name) values(concat ('ignore', 'space')); | ||
|
||
-- test sql_mode NO_AUTO_VALUE_ON_ZERO | ||
set @@session.sql_mode=concat(@@session.sql_mode, ',NO_AUTO_VALUE_ON_ZERO'); | ||
insert into t_2(id, name) values (20, 'a'); | ||
replace into t_2(id, name) values (0, 'c'); | ||
|
||
-- test sql_mode NO_BACKSLASH_ESCAPES | ||
set @@session.sql_mode=concat(@@session.sql_mode, ',NO_BACKSLASH_ESCAPES'); | ||
insert into t_2(name) values ('\\a'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
set @@session.sql_mode='ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,REAL_AS_FLOAT'; | ||
-- NO_AUTO_CREATE_USER set failed in mysql8.0 | ||
|
||
drop database if exists `sql_mode`; | ||
create database `sql_mode`; | ||
use `sql_mode`; | ||
CREATE TABLE `t_2` ( | ||
`id` int NOT NULL AUTO_INCREMENT, | ||
`name` varchar(60), | ||
`num` int, | ||
`dt` datetime, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
-- test sql_mode PIPES_AS_CONCAT | ||
set @@session.sql_mode=concat(@@session.sql_mode, ',PIPES_AS_CONCAT'); | ||
insert into t_2(name) values('pipes'||'as'||'concat'); | ||
|
||
-- test sql_mode ANSI_QUOTES | ||
insert into t_2(name) values("a"); | ||
|
||
-- test sql_mode IGNORE_SPACE | ||
set @@session.sql_mode=concat(@@session.sql_mode, ',IGNORE_SPACE'); | ||
insert into t_2(name) values(concat ('ignore', 'space')); | ||
|
||
-- test sql_mode NO_AUTO_VALUE_ON_ZERO | ||
set @@session.sql_mode=concat(@@session.sql_mode, ',NO_AUTO_VALUE_ON_ZERO'); | ||
insert into t_2(id, name) values (10, 'a'); | ||
insert into t_2(id, name) values (0, 'b'); | ||
|
||
-- test sql_mode NO_BACKSLASH_ESCAPES | ||
set @@session.sql_mode=concat(@@session.sql_mode, ',NO_BACKSLASH_ESCAPES'); | ||
insert into t_2(name) values ('\\a'); |
Oops, something went wrong.