1
by brian
clean slate |
1 |
###################################################
|
2 |
#Author: Jeb |
|
3 |
#Date: 2007-06-11 |
|
4 |
#Purpose: To replace the mysqltest.c executable |
|
5 |
# wait_for_slave_to_stop function and |
|
6 |
# return this to the test language. |
|
7 |
#Details: |
|
8 |
# 1) Fill in and setup variables |
|
9 |
# 2) loop through looking for both |
|
10 |
# io and sql threads to stop |
|
11 |
# 3) If loops too long die. |
|
12 |
####################################################
|
|
13 |
connection slave; |
|
14 |
let $row_number= 1; |
|
15 |
let $run= 1; |
|
16 |
let $counter= 300; |
|
17 |
||
18 |
while ($run) |
|
19 |
{
|
|
20 |
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); |
|
21 |
if (`SELECT '$io_result' = 'No'`){ |
|
22 |
||
23 |
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); |
|
24 |
if (`SELECT '$sql_result' = 'No'`){ |
|
25 |
let $run= 0; |
|
26 |
}
|
|
27 |
}
|
|
28 |
sleep 0.1; |
|
29 |
if (!$counter){ |
|
30 |
--echo "Failed while waiting for slave to stop" |
|
31 |
--replace_result $MASTER_MYPORT MASTER_PORT |
|
32 |
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # |
|
33 |
query_vertical SHOW SLAVE STATUS; |
|
34 |
exit; |
|
35 |
}
|
|
36 |
dec $counter; |
|
37 |
}
|
|
38 |
||
39 |