1# Test for BUG#1858 "OPTIMIZE TABLE done by a client 2# thread stops the slave SQL thread". 3# You can replace OPTIMIZE by REPAIR. 4##################################### 5# Change Author: JBM 6# Change Date: 2006-02-09 7# OPTIMIZE for memory tables. If and when 8# it does support for Disk Data, a new 9# version of this test will be need. 10##################################### 11# Slow test, don't run during staging part 12-- source include/not_staging.inc 13-- source include/master-slave.inc 14 15--disable_warnings 16drop tables if exists t1; 17--enable_warnings 18 19disable_query_log; 20call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 21enable_query_log; 22 23create table t1 (a int not null auto_increment primary key, b int, key(b)); 24INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); 25--disable_warnings 26INSERT INTO t1 (a) SELECT null FROM t1; 27INSERT INTO t1 (a) SELECT null FROM t1; 28INSERT INTO t1 (a) SELECT null FROM t1; 29INSERT INTO t1 (a) SELECT null FROM t1; 30INSERT INTO t1 (a) SELECT null FROM t1; 31INSERT INTO t1 (a) SELECT null FROM t1; 32INSERT INTO t1 (a) SELECT null FROM t1; 33INSERT INTO t1 (a) SELECT null FROM t1; 34INSERT INTO t1 (a) SELECT null FROM t1; 35INSERT INTO t1 (a) SELECT null FROM t1; 36INSERT INTO t1 (a) SELECT null FROM t1; 37INSERT INTO t1 (a) SELECT null FROM t1; 38INSERT INTO t1 (a) SELECT null FROM t1; 39--enable_warnings 40save_master_pos; 41# a few updates to force OPTIMIZE to do something 42--disable_warnings 43update t1 set b=(a/2*rand()); 44delete from t1 order by b limit 10000; 45--enable_warnings 46 47connection slave; 48sync_with_master; 49optimize table t1; 50connection master; 51save_master_pos; 52connection slave; 53# Bug was that when the INSERT terminated on slave, 54# the slave SQL thread got killed by OPTIMIZE. 55sync_with_master; # won't work if slave SQL thread stopped 56 57connection master; # cleanup 58drop table t1; 59sync_slave_with_master; 60 61# If the machine is so fast that slave syncs before OPTIMIZE 62# starts, this test will demonstrate nothing but will pass. 63 64# End of 4.1 tests 65--source include/rpl_end.inc 66