diff options
author | unknown <Li-Bing.Song@sun.com> | 2009-10-20 14:30:15 +0800 |
---|---|---|
committer | unknown <Li-Bing.Song@sun.com> | 2009-10-20 14:30:15 +0800 |
commit | 36fd029eff9526e0f09f6cb081cb84cfd5dd3773 (patch) | |
tree | f45d87cf5e0635994d2b198001e60d8e04680b34 /mysql-test/include/wait_show_condition.inc | |
parent | 6ae50d8aedbded8dcdc7504d116f25bcd02535ff (diff) | |
download | mariadb-git-36fd029eff9526e0f09f6cb081cb84cfd5dd3773.tar.gz |
Bug#13963 SHOW SLAVE HOSTS is unreliable
Before the patch, slaves only appear in the output of SHOW SLAVE HOSTS
when report-host option is set. If an expected slave does not appear in
the list, nobody knows whether the slave does not connect or has started
without the "report-host" option. The output also contains a strange
field "Rpl_recovery_rank" which has never been implemented and the manual
of MySQL5.4 declares that the field has been removed from MySQL5.4.
This patch is done with these,
According to the manual of MySQL5.4, "Rpl_recovery_rank" is removed.
Slaves will register themselves to master no matter if report_host option is set
or not. When slaves are registering themselves, their Server_ids, report_host
and other information are together sent to master. Sever_ids are never null
and is unique in one replication group. Slaves always can be identified with
different Server_ids no matter if report_host exists.
Diffstat (limited to 'mysql-test/include/wait_show_condition.inc')
-rw-r--r-- | mysql-test/include/wait_show_condition.inc | 74 |
1 files changed, 53 insertions, 21 deletions
diff --git a/mysql-test/include/wait_show_condition.inc b/mysql-test/include/wait_show_condition.inc index 253101d1e07..f683ca7b47b 100644 --- a/mysql-test/include/wait_show_condition.inc +++ b/mysql-test/include/wait_show_condition.inc @@ -2,13 +2,16 @@ # # SUMMARY # -# Waits until the show statement ($show_statement) has at least within one of -# the rows of the result set for the field ($field) a value which fulfils +# Waits until the show statement ($show_statement) has one or all of the +# rows of the result set for the field ($field) a value which fulfils # a condition ($condition), or the operation times out. # # # USAGE # +# All rows of the result must fulfil the condition if $all_rows_fulfil is 1 +# else at least one of the result must fulfil the condition. +# let $wait_for_all= 1; # let $show_statement= SHOW PROCESSLIST; # let $field= State; # let $condition= = 'Updating'; @@ -46,27 +49,56 @@ inc $max_run_time; let $found= 0; let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`; -while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`) + +if (`SELECT '$wait_for_all' != '1'`) { - # Sleep a bit to avoid too heavy load. - real_sleep 0.2; - let $rowno= 1; - let $process_result= 1; - while (`SELECT $process_result = 1 AND $found = 0`) - { - let $field_value= query_get_value($show_statement, $field, $rowno); - if (`SELECT '$field_value' $condition`) - { - let $found= 1; - } - if (`SELECT '$field_value' = 'No such row'`) - { - # We are behind the last row of the result set. - let $process_result= 0; - } - inc $rowno; - } + while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`) + { + # Sleep a bit to avoid too heavy load. + real_sleep 0.2; + let $rowno= 1; + let $process_result= 1; + while (`SELECT $process_result = 1 AND $found = 0`) + { + let $field_value= query_get_value($show_statement, $field, $rowno); + if (`SELECT '$field_value' $condition`) + { + let $found= 1; + } + if (`SELECT '$field_value' = 'No such row'`) + { + # We are behind the last row of the result set. + let $process_result= 0; + } + inc $rowno; + } + } } + +if (`SELECT '$wait_for_all' = '1'`) +{ + while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`) + { + # Sleep a bit to avoid too heavy load. + real_sleep 0.2; + let $rowno= 1; + let $process_result= 1; + while (`SELECT $process_result = 1 AND $found = 0`) + { + let $field_value= query_get_value($show_statement, $field, $rowno); + if (`SELECT '$field_value' = 'No such row'`) + { + let $found= 1; + } + if (`SELECT $found = 0 AND NOT '$field_value' $condition`) + { + let process_result= 0; + } + inc $rowno; + } + } +} + if (!$found) { echo # Timeout in include/wait_show_condition.inc for $wait_condition; |