WL#4091, part1. replace --sleep by include/wait_condition.inc

parent 60880ec8
...@@ -4,8 +4,8 @@ reset master; ...@@ -4,8 +4,8 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
stop slave;
create table t1(n int); create table t1(n int);
stop slave;
start slave; start slave;
stop slave io_thread; stop slave io_thread;
start slave io_thread; start slave io_thread;
......
...@@ -34,7 +34,8 @@ connection master1; ...@@ -34,7 +34,8 @@ connection master1;
# This sleep is picked so that the query above has started to insert # This sleep is picked so that the query above has started to insert
# some rows into t2. If it hasn't the slave will not stop below. # some rows into t2. If it hasn't the slave will not stop below.
sleep 4; let $wait_condition= SELECT COUNT(*) > 1000 FROM t1;
source include/wait_condition.inc
# SHOW PROCESSLIST; # SHOW PROCESSLIST;
......
...@@ -43,7 +43,8 @@ insert into t3 values(connection_id()); ...@@ -43,7 +43,8 @@ insert into t3 values(connection_id());
send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10); send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
connection master1; connection master1;
real_sleep 2; let $wait_condition= SELECT a > 1 FROM t2;
source include/wait_condition.inc;
select (@id := id) - id from t3; select (@id := id) - id from t3;
kill @id; kill @id;
drop table t2,t3; drop table t2,t3;
......
...@@ -6,7 +6,6 @@ source include/master-slave.inc; ...@@ -6,7 +6,6 @@ source include/master-slave.inc;
save_master_pos; save_master_pos;
connection slave; connection slave;
sleep 1;
show variables like 'init_slave'; show variables like 'init_slave';
show variables like 'max_connections'; show variables like 'max_connections';
sync_with_master; sync_with_master;
......
...@@ -17,18 +17,8 @@ let $query = "INSERT DELAYED INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With ...@@ -17,18 +17,8 @@ let $query = "INSERT DELAYED INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";" --exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
# Wait until all the 5000 inserts has been inserted into the table # Wait until all the 5000 inserts has been inserted into the table
--disable_query_log let $wait_condition= SELECT COUNT(*) = 5000 FROM mysqlslap.t1;
let $counter= 300; # Max 30 seconds wait --source include/wait_condition.inc
while (`select count(*)!=5000 from mysqlslap.t1`)
{
sleep 0.1;
dec $counter;
if (!$counter)
{
Number of records in t1 didnt reach 5000;
}
}
--enable_query_log
SELECT COUNT(*) FROM mysqlslap.t1; SELECT COUNT(*) FROM mysqlslap.t1;
sync_slave_with_master; sync_slave_with_master;
......
...@@ -36,11 +36,12 @@ delimiter ;| ...@@ -36,11 +36,12 @@ delimiter ;|
CALL test.p1(); CALL test.p1();
SELECT * FROM test.t1 ORDER BY blob_column; SELECT * FROM test.t1 ORDER BY blob_column;
save_master_pos; save_master_pos;
# Need to allow some time when NDB engine is used for
# the injector thread to have time to populate binlog
sleep 10;
sync_slave_with_master; sync_slave_with_master;
connection slave; connection slave;
# Need to allow some time when NDB engine is used for
# the injector thread to have time to populate binlog
let $wait_condition= SELECT INSTR(blob_column,'aberration') > 0 FROM test.t1 WHERE a = 2;
--source include/wait_condition.inc
SELECT * FROM test.t1 ORDER BY blob_column; SELECT * FROM test.t1 ORDER BY blob_column;
# Cleanup # Cleanup
......
...@@ -46,11 +46,15 @@ delimiter ;// ...@@ -46,11 +46,15 @@ delimiter ;//
-- disable_query_log -- disable_query_log
-- disable_result_log -- disable_result_log
SET @wait_count=1;
let $1=10; let $1=10;
while ($1) while ($1)
{ {
call test.p1(); call test.p1();
sleep 1; let $wait_condition= SELECT COUNT(*) = @wait_count FROM test.t1;
-- source include/wait_condition.inc
-- disable_query_log
SET @wait_count = @wait_count + 1;
dec $1; dec $1;
} }
-- enable_result_log -- enable_result_log
......
...@@ -84,7 +84,8 @@ let $message=< ---- Master selects-- >; ...@@ -84,7 +84,8 @@ let $message=< ---- Master selects-- >;
--source include/show_msg.inc --source include/show_msg.inc
connection master; connection master;
CALL test.p1(); CALL test.p1();
sleep 6; let $wait_condition= SELECT COUNT(*) = 4 FROM t3;
--source include/wait_condition.inc
SELECT * FROM test.t3 ORDER BY id3; SELECT * FROM test.t3 ORDER BY id3;
let $message=< ---- Slave selects-- >; let $message=< ---- Slave selects-- >;
......
...@@ -33,7 +33,8 @@ start slave; ...@@ -33,7 +33,8 @@ start slave;
# hope one second is not enough for slave to reach the last # hope one second is not enough for slave to reach the last
# Rows_log_event, so that test actually tests something. # Rows_log_event, so that test actually tests something.
real_sleep 1; let $wait_condition= SELECT COUNT(*) >= 10 FROM t1;
--source include/wait_condition.inc
stop slave; stop slave;
# see if slave hangs on DROP TABLE # see if slave hangs on DROP TABLE
......
...@@ -53,11 +53,15 @@ delimiter ;// ...@@ -53,11 +53,15 @@ delimiter ;//
-- disable_query_log -- disable_query_log
-- disable_result_log -- disable_result_log
SET @wait_count = 1;
let $1=10; let $1=10;
while ($1) while ($1)
{ {
CALL test.p2(); CALL test.p2();
sleep 1; let $wait_condition= SELECT COUNT(*) = @wait_count FROM test.t3;
--source include/wait_condition.inc
--disable_query_log
SET @wait_count = @wait_count + 1;
dec $1; dec $1;
} }
-- enable_result_log -- enable_result_log
......
...@@ -108,11 +108,13 @@ UPDATE test.t2 SET b1 = 0 WHERE b1 = 1; ...@@ -108,11 +108,13 @@ UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW()); INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
# To make sure BUG#14698 is gone, we sleep 2 seconds before calling trigger # To make sure BUG#14698 is gone, we sleep before calling trigger
# (with the bug in, that caused differences in TIMESTAMP columns). # (with the bug in, that caused differences in TIMESTAMP columns).
# We just need to let the machine's clock advance, it's not # We just need to let the machine's clock advance, it's not
# to do synchronization, so real_sleep is good. # to do synchronization.
real_sleep 2;
let $wait_condition= SELECT SUM(f)= ROUND(SUM(f)) FROM t3;
--source include/wait_condition.inc
DELETE FROM test.t1 WHERE id = 1; DELETE FROM test.t1 WHERE id = 1;
......
...@@ -24,7 +24,8 @@ start slave; ...@@ -24,7 +24,8 @@ start slave;
connection master; connection master;
insert into t1 values (1); insert into t1 values (1);
#reasonable timeout for changes to propagate to slave #reasonable timeout for changes to propagate to slave
sleep 3; let $wait_condition= SELECT COUNT(*) = 1 FROM t1;
source include/wait_condition.inc;
connection slave; connection slave;
select * from t1; select * from t1;
......
...@@ -3,12 +3,12 @@ source include/master-slave.inc; ...@@ -3,12 +3,12 @@ source include/master-slave.inc;
# #
# Bug#6148 () # Bug#6148 ()
# #
connection slave;
stop slave;
# Let the master do lots of insertions # Let the master do lots of insertions
connection master; connection master;
create table t1(n int); create table t1(n int);
sync_slave_with_master;
stop slave;
connection master;
let $1=5000; let $1=5000;
disable_query_log; disable_query_log;
while ($1) while ($1)
...@@ -21,7 +21,8 @@ save_master_pos; ...@@ -21,7 +21,8 @@ save_master_pos;
connection slave; connection slave;
start slave; start slave;
sleep 1; let $wait_condition= SELECT COUNT(*) > 0 FROM t1;
source include/wait_condition.inc;
stop slave io_thread; stop slave io_thread;
start slave io_thread; start slave io_thread;
sync_with_master; sync_with_master;
......
...@@ -293,7 +293,8 @@ insert delayed into t2 values(rand()); ...@@ -293,7 +293,8 @@ insert delayed into t2 values(rand());
set @a=2.345; set @a=2.345;
insert delayed into t2 values(@a); insert delayed into t2 values(@a);
sleep 4; # time for the delayed inserts to reach disk let $wait_condition= SELECT COUNT(*) = 19 FROM t2;
--source include/wait_condition.inc
# If you want to do manual testing of the mixed mode regarding UDFs (not # If you want to do manual testing of the mixed mode regarding UDFs (not
# testable automatically as quite platform- and compiler-dependent), # testable automatically as quite platform- and compiler-dependent),
......
...@@ -60,23 +60,24 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ...@@ -60,23 +60,24 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
connection con1; connection con1;
create temporary table t3(f int); create temporary table t3(f int);
insert into t3 select * from t1 where f<6; insert into t3 select * from t1 where f<6;
sleep 1; let $wait_condition= SELECT COUNT(*) = 5 FROM t3;
--source include/wait_condition.inc
connection con2; connection con2;
create temporary table t3(f int); create temporary table t3(f int);
sleep 1;
connection con1; connection con1;
insert into t2 select count(*) from t3; insert into t2 select count(*) from t3;
sleep 1; let $wait_condition= SELECT COUNT(*) = 1 FROM t2;
--source include/wait_condition.inc
connection con2; connection con2;
insert into t3 select * from t1 where f>=4; insert into t3 select * from t1 where f>=4;
sleep 1; let $wait_condition= SELECT COUNT(*) = 7 FROM t3;
--source include/wait_condition.inc
connection con1; connection con1;
drop temporary table t3; drop temporary table t3;
sleep 1;
connection con2; connection con2;
insert into t2 select count(*) from t3; insert into t2 select count(*) from t3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment