added tests for column-reorder
This commit is contained in:
parent
13b35478a1
commit
53ef6eae5a
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
|
||||
extra_args=$(cat $tests_path/$test_name/extra_args)
|
||||
fi
|
||||
columns="*"
|
||||
if [ -f $tests_path/$test_name/test_columns ] ; then
|
||||
columns=$(cat $tests_path/$test_name/test_columns)
|
||||
orig_columns="*"
|
||||
ghost_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
|
||||
# graceful sleep for replica to catch up
|
||||
echo_dot
|
||||
@ -98,15 +102,15 @@ test_single() {
|
||||
fi
|
||||
|
||||
echo_dot
|
||||
orig_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${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)
|
||||
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 ${ghost_columns} from _gh_ost_test_gho" -ss | md5sum)
|
||||
|
||||
if [ "$orig_checksum" != "$ghost_checksum" ] ; then
|
||||
echo "ERROR $test_name: checksum mismatch"
|
||||
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 "---"
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user