Skip to content

Commit

Permalink
test: fix unstabled drop then add column (pingcap#1548) (pingcap#1549)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Mar 31, 2021
1 parent bae4109 commit a004da0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
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 @@ -535,8 +535,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"
done
}

Expand Down

0 comments on commit a004da0

Please sign in to comment.