| 1 |
# include/wait_show_pattern.inc |
| 2 |
# |
| 3 |
# SUMMARY |
| 4 |
# |
| 5 |
# Waits until output produced by SHOW statement which particular type is |
| 6 |
# specified as parameter matches certain pattern or maximum time reached. |
| 7 |
# |
| 8 |
# NOTES |
| 9 |
# |
| 10 |
# Only the first row produced by the parameter statement is checked. |
| 11 |
# |
| 12 |
# USAGE |
| 13 |
# |
| 14 |
# let $show_type= <Tail of SHOW statement>; |
| 15 |
# let $show_pattern= 'Pattern to be used for LIKE matching'; |
| 16 |
# --source wait_show_pattern.inc |
| 17 |
# |
| 18 |
# EXAMPLES |
| 19 |
# |
| 20 |
# alter_table-big.test, wait_slave_status.inc |
| 21 |
# |
| 22 |
# SEE ALSO |
| 23 |
# |
| 24 |
# wait_slave_status.inc, wait_condition.inc (>=5.1) |
| 25 |
# |
| 26 |
############################################################################### |
| 27 |
|
| 28 |
--disable_query_log |
| 29 |
|
| 30 |
# We accept to wait maximum 30 seconds (0.2 sec/loop). |
| 31 |
let $wait_counter= 150; |
| 32 |
while ($wait_counter) |
| 33 |
{ |
| 34 |
let $result= `SHOW $show_type`; |
| 35 |
let $success= `SELECT '$result' LIKE $show_pattern`; |
| 36 |
if ($success) |
| 37 |
{ |
| 38 |
let $wait_counter= 0; |
| 39 |
} |
| 40 |
if (!$success) |
| 41 |
{ |
| 42 |
real_sleep 0.2; |
| 43 |
dec $wait_counter; |
| 44 |
} |
| 45 |
} |
| 46 |
if (!$success) |
| 47 |
{ |
| 48 |
echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result'); |
| 49 |
} |
| 50 |
|
| 51 |
--enable_query_log |