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

test: fix unstabled drop then add column #1548

Merged
merged 2 commits into from
Mar 30, 2021
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
19 changes: 2 additions & 17 deletions tests/sequence_sharding_optimistic/data/db1.increment.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,9 @@ alter table t2 drop column c1;
insert into t1 (id, c2) values (100006, '120006');
insert into t2 (id, c2, c3) values (200006, '220006', 230006);

alter table t2 add column c1 varchar(20);
-- at this point:
-- t1(id, c2)
-- t2(id, c1, c2, c3)
insert into t2 (id, c1, c2, c3) values (200007, '210007', '220007', 230007);
insert into t1 (id, c2) values (100007, '120007');

alter table t2 drop column c1;
-- at this point:
-- t1(id, c2)
-- t2(id, c2, c3)
insert into t1 (id, c2) values (100008, '120008');
insert into t2 (id, c2, c3) values (200008, '220008', 230008);

alter table t1 add column c3 int;
-- at this point:
-- t1(id, c2, c3)
-- t2(id, c2, c3)
insert into t2 (id, c2, c3) values (200009, '220009', 230009);
insert into t1 (id, c2, c3) values (100009, '120009', 130009);

insert into t2 (id, c2, c3) values (200007, '220007', 230007);
insert into t1 (id, c2, c3) values (100007, '120007', 130007);
12 changes: 10 additions & 2 deletions tests/sequence_sharding_optimistic/data/db1.increment2.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
use `sharding_seq_opt`;

alter table t2 add column c1 varchar(20);
-- at this point:
-- t1(id, c2, c3)
-- t2(id, c1, c2, c3)
insert into t2 (id, c1, c2, c3) values (200008, '210008', '220008', 230008);
insert into t1 (id, c2, c3) values (100008, '120008', 130008);

alter table t2 drop column c1;
-- at this point:
-- t1(id, c2, c3)
-- t2(id, c2, c3)
insert into t1 (id, c2, c3) values (100010, '120010', 130010);
insert into t2 (id, c2, c3) values (200010, '220010', 230010);
insert into t1 (id, c2, c3) values (100009, '120009', 130009);
insert into t2 (id, c2, c3) values (200009, '220009', 230009);

3 changes: 1 addition & 2 deletions tests/shardddl1/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,7 @@ function DM_RENAME_COLUMN_OPTIMISTIC_CASE() {
"\"result\": true" 2

run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"resume-task test -s mysql-replica-02" \
"\"result\": true" 2
"resume-task test -s mysql-replica-02"

# source2.table2's ddl fails
# Unknown column 'a' in 'tb2'
Expand Down
6 changes: 3 additions & 3 deletions tests/shardddl3/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1083,9 +1083,9 @@ function DM_DropAddColumn() {
do
echo "run DM_DropAddColumn case #${i}"
run_case DropAddColumn "double-source-optimistic" \
"run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b int, c int);\"; \
run_sql_source2 \"create table ${shardddl1}.${tb1} (a int primary key, b int, c int);\"" \
"clean_table" "optimistic" "$i"
"run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b int, c int);\"; \
run_sql_source2 \"create table ${shardddl1}.${tb1} (a int primary key, b int, c int);\"" \
"clean_table" "optimistic" "$i"
Comment on lines +1086 to +1088
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b int, c int);\"; \
run_sql_source2 \"create table ${shardddl1}.${tb1} (a int primary key, b int, c int);\"" \
"clean_table" "optimistic" "$i"
"run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b int, c int);\"; \
run_sql_source2 \"create table ${shardddl1}.${tb1} (a int primary key, b int, c int);\"" \
"clean_table" "optimistic" "$i"

done
}

Expand Down