Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(dm): enable new charset for TiDB in test #3736

Merged
merged 17 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from 12 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 dm/step_by_step_contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Edit some code on the `new-branch-name` branch and save your changes to fix the

```sh
docker run --rm --name mysql-3306 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7.22 --log-bin=mysql-bin --port=3306 --bind-address=0.0.0.0 --binlog-format=ROW --server-id=1 --gtid_mode=ON --enforce-gtid-consistency=true > mysql.3306.log 2>&1 &
docker run --rm --name mysql-3307 -p 3307:3307 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7.22 --log-bin=mysql-bin --port=3307 --bind-address=0.0.0.0 --binlog-format=ROW --server-id=1 --gtid_mode=ON --enforce-gtid-consistency=true > mysql.3307.log 2>&1 &
docker run --rm --name mysql-3307 -p 3307:3307 -e MYSQL_ROOT_PASSWORD=123456 mysql:8.0.21 --log-bin=mysql-bin --port=3307 --bind-address=0.0.0.0 --binlog-format=ROW --server-id=1 --gtid_mode=ON --enforce-gtid-consistency=true > mysql.3307.log 2>&1 &
```

3. Run integration test
Expand Down
9 changes: 5 additions & 4 deletions dm/tests/_utils/check_sync_diff
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ fi

PWD=$(pwd)
binary=$PWD/bin/sync_diff_inspector
LOG=$workdir/sync_diff_inspector.log
OUTPUT_DIR=/tmp/ticdc_dm_test/output/
STDOUT=$workdir/sync_diff_stdout.log

mkdir -p /tmp/ticdc_dm_test

cd $workdir
i=0
while [ $i -lt $check_time ]; do
rm -rf $OUTPUT_DIR
$binary --config=$conf >>$LOG 2>&1
$binary --config=$conf -L=debug >$STDOUT 2>&1
ret=$?
if [ "$ret" == 0 ]; then
echo "check diff successfully"
Expand All @@ -41,8 +41,9 @@ if [ $i -ge $check_time ]; then
echo "check diff failed at last"
if [[ $4 != "fail" ]]; then
# show \n and other blanks
cat $LOG
printf "\n"
printf "$STDOUT\n"
cat $STDOUT
printf "$OUTPUT_DIR/sync_diff.log\n"
cat $OUTPUT_DIR/sync_diff.log
printf "\n"
exit 1
Expand Down
3 changes: 3 additions & 0 deletions dm/tests/_utils/run_dm_ctl_with_tls_and_retry
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ for ((k = 0; k < 10; k++)); do

sleep 2
done

exit 1

# gocovmerge doesn't support merge profiles with different modes, however atomic
# mode and count mode have the same profile format, so we need to unify cover
# mode before running gocovmerge. As coverage file is not generated synchronously,
Expand Down
17 changes: 14 additions & 3 deletions dm/tests/_utils/run_tidb_server
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,31 @@

set -eu

tmp_config="/tmp/dm_test/tidb.toml"

PORT=$1
PASSWORD=$2
CONFIG=""

rm $tmp_config || true
cat >$tmp_config <<EOF
new_collations_enabled_on_first_bootstrap = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not let cases which depends on this flag opens it separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the default test behaviour to avoid we forget collation compatibility in future (such as a new developer add a test and reviews forget checking collation).


[experimental]
enable-new-charset = true

EOF

if [ "$#" -ge 3 ]; then
CONFIG=$3
cat $3 >>$tmp_config
WizardXiao marked this conversation as resolved.
Show resolved Hide resolved
fi

TEST_DIR=/tmp/dm_test

echo "Starting TiDB on port ${PORT}"
bin/tidb-server \
-P ${PORT} \
--store mocktikv \
--config "$CONFIG" \
--config "$tmp_config" \
--log-file "$TEST_DIR/tidb.log" &

echo "Verifying TiDB is started..."
Expand Down
4 changes: 2 additions & 2 deletions dm/tests/online_ddl/data/gho.db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop database if exists `online_ddl`;
create database `online_ddl`;
use `online_ddl`;
create table gho_t1 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table gho_t2 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table gho_t1 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table gho_t2 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into gho_t1 (uid, name) values (10001, 'Gabriel García Márquez'), (10002, 'Cien años de soledad');
insert into gho_t2 (uid, name) values (20001, 'José Arcadio Buendía'), (20002, 'Úrsula Iguarán'), (20003, 'José Arcadio');
4 changes: 2 additions & 2 deletions dm/tests/online_ddl/data/gho.db2.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop database if exists `online_ddl`;
create database `online_ddl`;
use `online_ddl`;
create table gho_t2 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table gho_t3 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table gho_t2 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table gho_t3 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into gho_t2 (uid, name, info) values (40000, 'Remedios Moscote', '{}'), (40001, 'Amaranta', '{"age": 0}');
insert into gho_t3 (uid, name, info) values (30001, 'Aureliano José', '{}'), (30002, 'Santa Sofía de la Piedad', '{}'), (30003, '17 Aurelianos', NULL);
4 changes: 2 additions & 2 deletions dm/tests/online_ddl/data/pt.db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use `online_ddl`;
create table pt_t1 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table pt_t2 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table pt_t1 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table pt_t2 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into pt_t1 (uid, name) values (10001, 'Gabriel García Márquez'), (10002, 'Cien años de soledad');
insert into pt_t2 (uid, name) values (20001, 'José Arcadio Buendía'), (20002, 'Úrsula Iguarán'), (20003, 'José Arcadio');
4 changes: 2 additions & 2 deletions dm/tests/online_ddl/data/pt.db2.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use `online_ddl`;
create table pt_t2 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table pt_t3 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table pt_t2 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table pt_t3 (id bigint auto_increment, uid int, name varchar(80), info varchar(100), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into pt_t2 (uid, name, info) values (40000, 'Remedios Moscote', '{}'), (40001, 'Amaranta', '{"age": 0}');
insert into pt_t3 (uid, name, info) values (30001, 'Aureliano José', '{}'), (30002, 'Santa Sofía de la Piedad', '{}'), (30003, '17 Aurelianos', NULL);
4 changes: 2 additions & 2 deletions dm/tests/safe_mode/data/db2.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop database if exists `safe_mode_test`;
create database `safe_mode_test`;
use `safe_mode_test`;
create table t2 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT = 200;
create table t3 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT = 300;
create table t2 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) AUTO_INCREMENT = 200;
create table t3 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) AUTO_INCREMENT = 300;
insert into t2 (uid, name) values (40000, 'Remedios Moscote'), (40001, 'Amaranta');
insert into t3 (uid, name) values (30001, 'Aureliano José'), (30002, 'Santa Sofía de la Piedad'), (30003, '17 Aurelianos');
4 changes: 2 additions & 2 deletions dm/tests/sequence_safe_mode/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop database if exists `sequence_safe_mode_test`;
create database `sequence_safe_mode_test`;
use `sequence_safe_mode_test`;
create table t1 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t2 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t1 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table t2 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into t1 (uid, name) values (10001, 'Gabriel García Márquez'), (10002, 'Cien años de soledad');
insert into t2 (uid, name) values (20001, 'José Arcadio Buendía'), (20002, 'Úrsula Iguarán'), (20003, 'José Arcadio');
4 changes: 2 additions & 2 deletions dm/tests/sequence_safe_mode/data/db2.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop database if exists `sequence_safe_mode_test`;
create database `sequence_safe_mode_test`;
use `sequence_safe_mode_test`;
create table t2 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t3 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t2 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table t3 (id bigint auto_increment, uid int, name varchar(80), primary key (`id`), unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into t2 (uid, name) values (40000, 'Remedios Moscote'), (40001, 'Amaranta');
insert into t3 (uid, name) values (30001, 'Aureliano José'), (30002, 'Santa Sofía de la Piedad'), (30003, '17 Aurelianos');
4 changes: 2 additions & 2 deletions dm/tests/sequence_sharding/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop database if exists `sharding_seq`;
create database `sharding_seq`;
use `sharding_seq`;
create table t1 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t2 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t1 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table t2 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into t1 (uid,name) values (100001,'igvApUx'),(100002,'qUyrcOBkwDK');
insert into t2 (uid,name) values (200001,'EycletJHetWHMfH'),(200002,'ytkIaCOwXnWmy'),(200003,'MWQeWw""''rNmtGxzGp');
6 changes: 3 additions & 3 deletions dm/tests/sequence_sharding/data/db2.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drop database if exists `sharding_seq`;
create database `sharding_seq`;
use `sharding_seq`;
create table t2 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t3 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t4 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t2 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table t3 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table t4 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into t2 (uid,name) values (300001,'io'),(300002,'xOKvsDsofmAzEF');
insert into t3 (uid,name) values (400001,'eXcRSo'),(400002,'QOP'),(400003,'DUotcCayM');
insert into t4 (uid,name) values (500001,'`id` = 15'),(500002,'942032497'),(500003,'UrhcHUbwsDMZrvJxM');
4 changes: 2 additions & 2 deletions dm/tests/sequence_sharding_removemeta/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop database if exists `sharding_seq`;
create database `sharding_seq`;
use `sharding_seq`;
create table t1 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t2 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t1 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table t2 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into t1 (uid,name) values (100001,'igvApUx'),(100002,'qUyrcOBkwDK');
insert into t2 (uid,name) values (200001,'EycletJHetWHMfH'),(200002,'ytkIaCOwXnWmy'),(200003,'MWQeWw""''rNmtGxzGp');
6 changes: 3 additions & 3 deletions dm/tests/sequence_sharding_removemeta/data/db2.prepare.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drop database if exists `sharding_seq`;
create database `sharding_seq`;
use `sharding_seq`;
create table t2 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t3 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t4 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4;
create table t2 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table t3 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
create table t4 (id bigint auto_increment,uid int,name varchar(20),primary key (`id`),unique key(`uid`)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into t2 (uid,name) values (300001,'io'),(300002,'xOKvsDsofmAzEF');
insert into t3 (uid,name) values (400001,'eXcRSo'),(400002,'QOP'),(400003,'DUotcCayM');
insert into t4 (uid,name) values (500001,'`id` = 15'),(500002,'942032497'),(500003,'UrhcHUbwsDMZrvJxM');
10 changes: 5 additions & 5 deletions dm/tests/shardddl1/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function DM_RENAME_COLUMN_OPTIMISTIC_CASE() {

# third, set schema to be same with upstream
# TODO: support set schema automatically base on upstream schema
echo 'CREATE TABLE `tb1` ( `c` int NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`c`)) ENGINE=InnoDB DEFAULT CHARSET=latin1' >${WORK_DIR}/schema1.sql
echo 'CREATE TABLE `tb1` ( `c` int NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`c`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin' >${WORK_DIR}/schema1.sql
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"binlog-schema update -s mysql-replica-01 test ${shardddl1} ${tb1} ${WORK_DIR}/schema1.sql --flush --sync" \
"\"result\": true" 2
Expand All @@ -175,7 +175,7 @@ function DM_RENAME_COLUMN_OPTIMISTIC_CASE() {
# Actually it should be tb2(a,b), dml is {a: 9, b: 'iii'}
# Now we set it to tb2(c,b), dml become {c: 9, b: 'iii'}
# This may only work for a "rename ddl"
echo 'CREATE TABLE `tb2` ( `c` int NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`c`)) ENGINE=InnoDB DEFAULT CHARSET=latin1' >${WORK_DIR}/schema2.sql
echo 'CREATE TABLE `tb2` ( `c` int NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`c`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin' >${WORK_DIR}/schema2.sql
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"binlog-schema update -s mysql-replica-02 test ${shardddl1} ${tb2} ${WORK_DIR}/schema2.sql --flush --sync" \
"\"result\": true" 2
Expand Down Expand Up @@ -228,9 +228,9 @@ function DM_RENAME_COLUMN_OPTIMISTIC_CASE() {
# maybe also work for some other unsupported ddls in optimistic mode
function DM_RENAME_COLUMN_OPTIMISTIC() {
run_case RENAME_COLUMN_OPTIMISTIC "double-source-optimistic" \
"run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10)) DEFAULT CHARSET=latin1;\"; \
run_sql_source2 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10)) DEFAULT CHARSET=latin1;\"; \
run_sql_source2 \"create table ${shardddl1}.${tb2} (a int primary key, b varchar(10)) DEFAULT CHARSET=latin1;\"" \
"run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10)) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;\"; \
run_sql_source2 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10)) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;\"; \
run_sql_source2 \"create table ${shardddl1}.${tb2} (a int primary key, b varchar(10)) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;\"" \
"clean_table" "optimistic"
}

Expand Down
4 changes: 2 additions & 2 deletions dm/tests/shardddl2/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ function DM_RECOVER_LOCK_CASE() {

function DM_RECOVER_LOCK() {
run_case RECOVER_LOCK "double-source-optimistic" \
"run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b int) DEFAULT CHARSET=latin1;\"; \
run_sql_source2 \"create table ${shardddl1}.${tb2} (a int primary key, b int) DEFAULT CHARSET=latin1;\"" \
"run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b int) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;\"; \
run_sql_source2 \"create table ${shardddl1}.${tb2} (a int primary key, b int) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;\"" \
"clean_table" "optimistic"
}

Expand Down
6 changes: 0 additions & 6 deletions dm/tests/shardddl3/conf/tidb-alter-pk-config.toml

This file was deleted.

17 changes: 4 additions & 13 deletions dm/tests/shardddl3/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function DM_077_CASE() {
}

function DM_077() {
run_sql_tidb "create database if not exists ${shardddl};"
run_sql_tidb "create table ${shardddl}.${tb} (id int, primary key(id) clustered);"
run_case 077 "single-source-pessimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (id int primary key);\"" "clean_table" ""
run_sql_tidb "create table ${shardddl}.${tb} (id int, primary key(id) clustered);"
Expand All @@ -114,33 +115,23 @@ 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() {
run_sql_source1 "insert into ${shardddl1}.${tb1} values (1, 'wer'), (2, NULL);"
run_sql_source1 "alter table ${shardddl1}.${tb1} drop primary key;"
run_sql_source1 "insert into ${shardddl1}.${tb1} values (0, 'wer'), (0, NULL);"

check_sync_diff $WORK_DIR $cur/conf/diff_config.toml
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"query-status test" \
"Unsupported drop primary key when the table's pkIsHandle is true" 1
}

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
Loading