~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
###################################################
2
#Author: Sven
3
#Date: 2007-10-09
4
#Purpose: Wait until the slave has an error in the
5
#         sql thread, as indicated by
6
#         "SHOW SLAVE STATUS", or at most 30
7
#         seconds.
8
#Details:
9
#      1) Fill in and setup variables
10
#      2) loop, looking for sql error on slave
11
#      3) If it 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 $sql_result= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, $row_number);
21
  let $run= `SELECT '$sql_result' = '0'`;
22
  if ($run) {
23
    real_sleep 0.1;
24
    if (!$counter){
25
      --echo "Failed while waiting for slave to produce an error in its sql thread"
26
      --replace_result $MASTER_MYPORT MASTER_PORT
27
      --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
28
      query_vertical SHOW SLAVE STATUS;
29
      exit;
30
    }
31
    dec $counter;
32
  }
33
}