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

Commit

Permalink
Merge branch 'release-2.0' into release-2.0-47b68f9bfa8d
Browse files Browse the repository at this point in the history
  • Loading branch information
lance6716 authored Mar 29, 2021
2 parents b8e85a6 + 9108ad4 commit 47f3bb5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/sequence_sharding_optimistic/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ run() {
# try to get schema for the table, the latest schema got.
curl -X PUT ${API_URL} -d '{"op":1, "task":"sequence_sharding_optimistic", "sources": ["mysql-replica-01"], "database":"sharding_seq_opt", "table":"t1"}' > ${WORK_DIR}/get_schema.log
# this is NON-CLUSTERED index
check_log_contains ${WORK_DIR}/get_schema.log 'CREATE TABLE `t1` ( `id` bigint(20) NOT NULL, `c2` varchar(20) DEFAULT NULL, `c3` int(11) DEFAULT NULL, PRIMARY KEY (`id`) /\*T!\[clustered_index\] NONCLUSTERED \*/) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin' 1
check_log_contains ${WORK_DIR}/get_schema.log 'CREATE TABLE `t1` ( `id` bigint(20) NOT NULL, `c2` varchar(20) DEFAULT NULL, `c3` int(11) DEFAULT NULL, PRIMARY KEY (`id`) .*) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin' 1

# drop the schema.
curl -X PUT ${API_URL} -d '{"op":3, "task":"sequence_sharding_optimistic", "sources": ["mysql-replica-01"], "database":"sharding_seq_opt", "table":"t1"}' > ${WORK_DIR}/remove_schema.log
Expand Down Expand Up @@ -188,7 +188,7 @@ run() {
curl -X PUT ${API_URL} -d '{"op":1, "task":"sequence_sharding_optimistic", "sources": ["mysql-replica-01"], "database":"sharding_seq_opt", "table":"t1"}' > ${WORK_DIR}/get_schema.log
cat ${WORK_DIR}/get_schema.log
# schema tracker enables alter-primary-key, so this is NONCLUSTERED index
check_log_contains ${WORK_DIR}/get_schema.log 'CREATE TABLE `t1` ( `id` bigint(20) NOT NULL, `c2` varchar(20) DEFAULT NULL, `c3` bigint(11) DEFAULT NULL, PRIMARY KEY (`id`) /\*T!\[clustered_index\] NONCLUSTERED \*/) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin' 1
check_log_contains ${WORK_DIR}/get_schema.log 'CREATE TABLE `t1` ( `id` bigint(20) NOT NULL, `c2` varchar(20) DEFAULT NULL, `c3` bigint(11) DEFAULT NULL, PRIMARY KEY (`id`) .*) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin' 1

# more data
run_sql_file $cur/data/db1.increment2.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1
Expand Down
6 changes: 6 additions & 0 deletions tests/shardddl3/conf/tidb-alter-pk-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# TiDB Configuration.

# alter-primary-key is used to control alter primary key feature. Default is false, indicate the alter primary key feature is disabled.
# If it is true, we can add the primary key by "alter table". However, if a table already exists before the switch is turned true and the data type of its primary key column is an integer,
# the primary key cannot be dropped.
alter-primary-key = true
11 changes: 11 additions & 0 deletions tests/shardddl3/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,15 @@ function DM_078_CASE() {
}

function DM_078() {
# start a TiDB alter-pk
pkill -hup tidb-server 2>/dev/null || true
wait_process_exit tidb-server
run_tidb_server 4000 $TIDB_PASSWORD $cur/conf/tidb-alter-pk-config.toml

run_case 078 "single-source-pessimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (id int unique, a int, b varchar(10));\"" "clean_table" ""
run_case 078 "single-source-optimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (id int unique, a int, b varchar(10));\"" "clean_table" ""

# don't revert tidb until DM_079
}

function DM_079_CASE() {
Expand All @@ -130,6 +136,11 @@ function DM_079_CASE() {
function DM_079() {
run_case 079 "single-source-pessimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10));\"" "clean_table" ""
run_case 079 "single-source-optimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10));\"" "clean_table" ""

# revert tidb
pkill -hup tidb-server 2>/dev/null || true
wait_process_exit tidb-server
run_tidb_server 4000 $TIDB_PASSWORD
}

function DM_080_CASE() {
Expand Down

0 comments on commit 47f3bb5

Please sign in to comment.