Merge pull request #240 from github/test-column-reorder
added tests for column-reorder
This commit is contained in:
commit
a6b33427de
26
localtests/rename-reorder-column/create.sql
Normal file
26
localtests/rename-reorder-column/create.sql
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
drop table if exists gh_ost_test;
|
||||||
|
create table gh_ost_test (
|
||||||
|
id int auto_increment,
|
||||||
|
c1 int not null,
|
||||||
|
c2 int not null,
|
||||||
|
primary key (id)
|
||||||
|
) auto_increment=1;
|
||||||
|
|
||||||
|
drop event if exists gh_ost_test;
|
||||||
|
delimiter ;;
|
||||||
|
create event gh_ost_test
|
||||||
|
on schedule every 1 second
|
||||||
|
starts current_timestamp
|
||||||
|
ends current_timestamp + interval 60 second
|
||||||
|
on completion not preserve
|
||||||
|
enable
|
||||||
|
do
|
||||||
|
begin
|
||||||
|
insert ignore into gh_ost_test values (1, 11, 23);
|
||||||
|
insert ignore into gh_ost_test values (2, 13, 23);
|
||||||
|
insert into gh_ost_test values (null, 17, 23);
|
||||||
|
set @last_insert_id := last_insert_id();
|
||||||
|
update gh_ost_test set c1=c1+@last_insert_id, c2=c2+@last_insert_id where id=@last_insert_id order by id desc limit 1;
|
||||||
|
delete from gh_ost_test where id=1;
|
||||||
|
delete from gh_ost_test where c1=13; -- id=2
|
||||||
|
end ;;
|
1
localtests/rename-reorder-column/extra_args
Normal file
1
localtests/rename-reorder-column/extra_args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--alter="change column c2 c2a int not null after id" --approve-renamed-columns
|
1
localtests/rename-reorder-column/ghost_columns
Normal file
1
localtests/rename-reorder-column/ghost_columns
Normal file
@ -0,0 +1 @@
|
|||||||
|
id, c1, c2a
|
1
localtests/rename-reorder-column/orig_columns
Normal file
1
localtests/rename-reorder-column/orig_columns
Normal file
@ -0,0 +1 @@
|
|||||||
|
id, c1, c2
|
27
localtests/rename-reorder-columns/create.sql
Normal file
27
localtests/rename-reorder-columns/create.sql
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
drop table if exists gh_ost_test;
|
||||||
|
create table gh_ost_test (
|
||||||
|
id int auto_increment,
|
||||||
|
c1 int not null,
|
||||||
|
c2 int not null,
|
||||||
|
c3 int not null,
|
||||||
|
primary key (id)
|
||||||
|
) auto_increment=1;
|
||||||
|
|
||||||
|
drop event if exists gh_ost_test;
|
||||||
|
delimiter ;;
|
||||||
|
create event gh_ost_test
|
||||||
|
on schedule every 1 second
|
||||||
|
starts current_timestamp
|
||||||
|
ends current_timestamp + interval 60 second
|
||||||
|
on completion not preserve
|
||||||
|
enable
|
||||||
|
do
|
||||||
|
begin
|
||||||
|
insert ignore into gh_ost_test values (1, 11, 23, 97);
|
||||||
|
insert ignore into gh_ost_test values (2, 13, 27, 61);
|
||||||
|
insert into gh_ost_test values (null, 17, 31, 53);
|
||||||
|
set @last_insert_id := last_insert_id();
|
||||||
|
update gh_ost_test set c1=c1+@last_insert_id, c2=c2+@last_insert_id, c3=c3+@last_insert_id where id=@last_insert_id order by id desc limit 1;
|
||||||
|
delete from gh_ost_test where id=1;
|
||||||
|
delete from gh_ost_test where c1=13; -- id=2
|
||||||
|
end ;;
|
1
localtests/rename-reorder-columns/extra_args
Normal file
1
localtests/rename-reorder-columns/extra_args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--alter="change column c2 c2a int not null, change column c3 c3 int not null after id" --approve-renamed-columns
|
1
localtests/rename-reorder-columns/ghost_columns
Normal file
1
localtests/rename-reorder-columns/ghost_columns
Normal file
@ -0,0 +1 @@
|
|||||||
|
id, c1, c2a, c3
|
1
localtests/rename-reorder-columns/orig_columns
Normal file
1
localtests/rename-reorder-columns/orig_columns
Normal file
@ -0,0 +1 @@
|
|||||||
|
id, c1, c2, c3
|
26
localtests/reorder-columns/create.sql
Normal file
26
localtests/reorder-columns/create.sql
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
drop table if exists gh_ost_test;
|
||||||
|
create table gh_ost_test (
|
||||||
|
id int auto_increment,
|
||||||
|
c1 int not null,
|
||||||
|
c2 int not null,
|
||||||
|
primary key (id)
|
||||||
|
) auto_increment=1;
|
||||||
|
|
||||||
|
drop event if exists gh_ost_test;
|
||||||
|
delimiter ;;
|
||||||
|
create event gh_ost_test
|
||||||
|
on schedule every 1 second
|
||||||
|
starts current_timestamp
|
||||||
|
ends current_timestamp + interval 60 second
|
||||||
|
on completion not preserve
|
||||||
|
enable
|
||||||
|
do
|
||||||
|
begin
|
||||||
|
insert ignore into gh_ost_test values (1, 11, 23);
|
||||||
|
insert ignore into gh_ost_test values (2, 13, 29);
|
||||||
|
insert into gh_ost_test values (null, 17, 31);
|
||||||
|
set @last_insert_id := last_insert_id();
|
||||||
|
update gh_ost_test set c1=c1+@last_insert_id, c2=c2+@last_insert_id where id=@last_insert_id order by id desc limit 1;
|
||||||
|
delete from gh_ost_test where id=1;
|
||||||
|
delete from gh_ost_test where c1=13;
|
||||||
|
end ;;
|
1
localtests/reorder-columns/extra_args
Normal file
1
localtests/reorder-columns/extra_args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--alter="change column c2 c2 int not null after id"
|
1
localtests/reorder-columns/ghost_columns
Normal file
1
localtests/reorder-columns/ghost_columns
Normal file
@ -0,0 +1 @@
|
|||||||
|
id, c1, c2
|
1
localtests/reorder-columns/orig_columns
Normal file
1
localtests/reorder-columns/orig_columns
Normal file
@ -0,0 +1 @@
|
|||||||
|
id, c1, c2
|
@ -56,9 +56,13 @@ test_single() {
|
|||||||
if [ -f $tests_path/$test_name/extra_args ] ; then
|
if [ -f $tests_path/$test_name/extra_args ] ; then
|
||||||
extra_args=$(cat $tests_path/$test_name/extra_args)
|
extra_args=$(cat $tests_path/$test_name/extra_args)
|
||||||
fi
|
fi
|
||||||
columns="*"
|
orig_columns="*"
|
||||||
if [ -f $tests_path/$test_name/test_columns ] ; then
|
ghost_columns="*"
|
||||||
columns=$(cat $tests_path/$test_name/test_columns)
|
if [ -f $tests_path/$test_name/orig_columns ] ; then
|
||||||
|
orig_columns=$(cat $tests_path/$test_name/orig_columns)
|
||||||
|
fi
|
||||||
|
if [ -f $tests_path/$test_name/ghost_columns ] ; then
|
||||||
|
ghost_columns=$(cat $tests_path/$test_name/ghost_columns)
|
||||||
fi
|
fi
|
||||||
# graceful sleep for replica to catch up
|
# graceful sleep for replica to catch up
|
||||||
echo_dot
|
echo_dot
|
||||||
@ -98,15 +102,15 @@ test_single() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo_dot
|
echo_dot
|
||||||
orig_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${columns} from gh_ost_test" -ss | md5sum)
|
orig_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss | md5sum)
|
||||||
ghost_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${columns} from _gh_ost_test_gho" -ss | md5sum)
|
ghost_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss | md5sum)
|
||||||
|
|
||||||
if [ "$orig_checksum" != "$ghost_checksum" ] ; then
|
if [ "$orig_checksum" != "$ghost_checksum" ] ; then
|
||||||
echo "ERROR $test_name: checksum mismatch"
|
echo "ERROR $test_name: checksum mismatch"
|
||||||
echo "---"
|
echo "---"
|
||||||
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${columns} from gh_ost_test" -ss
|
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss
|
||||||
echo "---"
|
echo "---"
|
||||||
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${columns} from _gh_ost_test_gho" -ss
|
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user