-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dumpling: add foreign key e2e test (#40133)
close #40227
- Loading branch information
1 parent
c8124a0
commit 92a936e
Showing
4 changed files
with
87 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# diff Configuration. | ||
|
||
check-thread-count = 4 | ||
|
||
export-fix-sql = true | ||
|
||
check-struct-only = false | ||
|
||
[task] | ||
output-dir = "./output" | ||
|
||
source-instances = ["mysql1"] | ||
|
||
target-instance = "tidb0" | ||
|
||
target-check-tables = ["e2e_foreign_key.parent", "e2e_foreign_key.child"] | ||
|
||
[data-sources] | ||
[data-sources.mysql1] | ||
host = "127.0.0.1" | ||
port = 3306 | ||
user = "root" | ||
password = "" | ||
|
||
[data-sources.tidb0] | ||
host = "127.0.0.1" | ||
port = 4000 | ||
user = "root" | ||
password = "" |
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,20 @@ | ||
### tidb-lightning config | ||
|
||
[lightning] | ||
server-mode = false | ||
level = "error" | ||
check-requirements = false | ||
|
||
[tikv-importer] | ||
backend = "tidb" | ||
on-duplicate = "error" | ||
|
||
[mydumper] | ||
data-source-dir = "/tmp/dumpling_test_result/sql_res.e2e_foreign_key" | ||
|
||
[tidb] | ||
host = "127.0.0.1" | ||
port = 4000 | ||
user = "root" | ||
password = "" | ||
status-port = 10080 |
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,8 @@ | ||
create database e2e_foreign_key DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ||
use e2e_foreign_key; | ||
create table parent (id int key); | ||
create table child (id int key, pid int, constraint fk_1 foreign key (pid) references parent(id)); | ||
insert into parent values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); | ||
insert into child values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10); | ||
set foreign_key_checks=0; | ||
insert into child values (100,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,30 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. | ||
|
||
set -eu | ||
cur=$(cd `dirname $0`; pwd) | ||
|
||
DB_NAME="e2e_foreign_key" | ||
|
||
# drop database on tidb | ||
export DUMPLING_TEST_PORT=4000 | ||
run_sql "drop database if exists $DB_NAME;" | ||
|
||
# drop database on mysql | ||
export DUMPLING_TEST_PORT=3306 | ||
run_sql "drop database if exists $DB_NAME;" | ||
|
||
# build data on mysql | ||
run_sql_file "$DUMPLING_BASE_NAME/data/e2e_foreign_key.sql" | ||
|
||
# dumping | ||
export DUMPLING_TEST_DATABASE=$DB_NAME | ||
run_dumpling | ||
|
||
cat "$cur/conf/lightning.toml" | ||
# use lightning import data to tidb | ||
run_lightning $cur/conf/lightning.toml | ||
|
||
# check mysql and tidb data | ||
check_sync_diff $cur/conf/diff_config.toml |