mariadb/mysql-test/t/myisam_optimize.test
Sergei Golubchik 59d9d08e2b 5.5 merge
2014-02-01 00:54:03 +01:00

48 lines
1.2 KiB
Text

#
# test OPTIMIZE and a concurrent SELECT of a MyISAM table
#
source include/have_debug_sync.inc;
call mtr.add_suppression(" marked as crashed and should be repaired");
create table t1 (a int auto_increment primary key, b text);
insert t1 (b) select repeat("A", 100);
insert t1 (b) select repeat("B", 200) from t1;
insert t1 (b) select repeat("C", 300) from t1;
delete from t1 where a < 3;
explain select a, left(b,10) from t1 order by a;
select left(b,10), a from t1 order by a;
set debug_sync='myisam_before_repair_by_sort wait_for go';
send optimize table t1;
connect (con1,localhost,root,,);
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state like "%myisam_before_repair_by_sort%";
--source include/wait_condition.inc
send select a, left(b,10) from t1 order by a;
connect (con2,localhost,root,,);
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock";
--source include/wait_condition.inc
set debug_sync='now signal go';
connection default;
reap;
connection con1;
reap;
disconnect con1;
disconnect con2;
connection default;
drop table t1;
set debug_sync='reset';