Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

precheck: support primary/unique key check #870

Merged
merged 7 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/pingcap/parser v0.0.0-20200717054943-cd445b0c607b
github.com/pingcap/pd/v4 v4.0.0-rc.2.0.20200714122454-1a64f969cb3c
github.com/pingcap/tidb v1.1.0-beta.0.20200728020902-472acf7b85b3
github.com/pingcap/tidb-tools v4.0.3-0.20200717061805-6483ba1f6311+incompatible
github.com/pingcap/tidb-tools v4.0.5-0.20200805025317-02a16e0521cb+incompatible
github.com/prometheus/client_golang v1.5.1
github.com/rakyll/statik v0.1.6
github.com/satori/go.uuid v1.2.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ github.com/pingcap/tidb-tools v4.0.0+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnw
github.com/pingcap/tidb-tools v4.0.1+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM=
github.com/pingcap/tidb-tools v4.0.3-0.20200717061805-6483ba1f6311+incompatible h1:ZqnNs4xV2X/Ba8EK5N4+XvMaoL6cd94F5YseaRxZARs=
github.com/pingcap/tidb-tools v4.0.3-0.20200717061805-6483ba1f6311+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM=
github.com/pingcap/tidb-tools v4.0.5-0.20200805025317-02a16e0521cb+incompatible h1:obFDQU7XvnCj8CiaXFP+bWaiQDp15Ueynk8cC0s5Utk=
github.com/pingcap/tidb-tools v4.0.5-0.20200805025317-02a16e0521cb+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM=
github.com/pingcap/tipb v0.0.0-20190428032612-535e1abaa330 h1:rRMLMjIMFulCX9sGKZ1hoov/iROMsKyC8Snc02nSukw=
github.com/pingcap/tipb v0.0.0-20190428032612-535e1abaa330/go.mod h1:RtkHW8WbcNxj8lsbzjaILci01CtYnYbIkQhjyZWrWVI=
github.com/pingcap/tipb v0.0.0-20200417094153-7316d94df1ee h1:XJQ6/LGzOSc/jo33AD8t7jtc4GohxcyODsYnb+kZXJM=
Expand Down
2 changes: 1 addition & 1 deletion tests/dm_syncer/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
drop database if exists `dm_syncer`;
create database `dm_syncer`;
use `dm_syncer`;
create table t1 (id int, name varchar(20));
create table t1 (id int, name varchar(20), primary key(`id`));
insert into t1 (id, name) values (1, 'arya'), (2, 'catelyn');
2 changes: 1 addition & 1 deletion tests/dmctl_command/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
drop database if exists `dmctl_command`;
create database `dmctl_command`;
use `dmctl_command`;
create table t1 (id int, name varchar(20));
create table t1 (id int, name varchar(20), primary key(`id`));
insert into t1 (id, name) values (1, 'arya'), (2, 'catelyn');
2 changes: 1 addition & 1 deletion tests/full_mode/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop database if exists `full_mode`;
create database `full_mode`;
use `full_mode`;
create table t1 (id int, name varchar(20));
create table t1 (id int, name varchar(20), primary key(`id`));
insert into t1 (id, name) values (1, 'arya'), (2, 'catelyn');
insert into t1 (id, name) values (3, 'Eddard Stark');
update t1 set name = 'Arya Stark' where id = 1;
Expand Down
2 changes: 1 addition & 1 deletion tests/full_mode/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function run() {
check_contains 'Query OK, 3 rows affected'

# test load data with `"` in the table name
run_sql_source1 "create table full_mode.\`tb\"1\` (id int,name varchar(10));"
run_sql_source1 "create table full_mode.\`tb\"1\` (id int,name varchar(10), primary key(\`id\`));"
run_sql_source1 "insert into full_mode.\`tb\"1\` values(1,'haha');"
run_sql_source1 "insert into full_mode.\`tb\"1\` values(2,'hihi');"

Expand Down
2 changes: 1 addition & 1 deletion tests/ha/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
drop database if exists `ha_test`;
create database `ha_test`;
use `ha_test`;
create table t1 (id int, name varchar(20));
create table t1 (id int, name varchar(20), primary key(`id`));
insert into t1 (id, name) values (1, 'arya'), (2, 'catelyn');
2 changes: 1 addition & 1 deletion tests/ha_cases/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
drop database if exists `database-placeholder`;
create database `database-placeholder`;
use `database-placeholder`;
create table ta (id int, name varchar(20));
create table ta (id int, name varchar(20), primary key(`id`));
insert into ta (id, name) values (1, 'arya'), (2, 'catelyn');
2 changes: 1 addition & 1 deletion tests/ha_master/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
drop database if exists `ha_master_test`;
create database `ha_master_test`;
use `ha_master_test`;
create table t1 (id int, name varchar(20));
create table t1 (id int, name varchar(20), primary key(`id`));
insert into t1 (id, name) values (1, 'arya'), (2, 'catelyn');
2 changes: 1 addition & 1 deletion tests/incremental_mode/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
drop database if exists `incremental_mode`;
create database `incremental_mode`;
use `incremental_mode`;
create table t1 (id int, name varchar(20));
create table t1 (id int, name varchar(20), primary key(`id`));
insert into t1 (id, name) values (1, 'arya'), (2, 'catelyn');
1 change: 1 addition & 0 deletions tests/shardddl1/conf/double-source-optimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "optimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl1/conf/double-source-pessimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "pessimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl1/conf/single-source-no-routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ task-mode: all
is-sharding: false
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl1/conf/single-source-no-sharding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ task-mode: all
is-sharding: false
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl1/conf/single-source-optimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "optimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl1/conf/single-source-pessimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "pessimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl2/conf/double-source-optimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "optimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl2/conf/double-source-pessimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "pessimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl3/conf/double-source-optimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "optimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl3/conf/double-source-pessimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "pessimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl3/conf/single-source-optimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "optimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/shardddl3/conf/single-source-pessimistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ is-sharding: true
shard-mode: "pessimistic"
meta-schema: "dm_meta"
timezone: "Asia/Shanghai"
ignore-checking-items: ["table_schema"]

target-database:
host: "127.0.0.1"
Expand Down