diff options
author | He Zhenxing <zhenxing.he@sun.com> | 2009-10-29 15:14:50 +0800 |
---|---|---|
committer | He Zhenxing <zhenxing.he@sun.com> | 2009-10-29 15:14:50 +0800 |
commit | 97565b8d1ab24b6f861300c75a4f4f3c7d711be6 (patch) | |
tree | 41b94973c8caff56ca47f8c473ae6118545b9302 /mysql-test | |
parent | e78fae218681a1ad02f506b7d124e01cdd3452c9 (diff) | |
parent | 39f7da882e2a90e8d5eb3f49c4ba361f2b631ad9 (diff) | |
download | mariadb-git-97565b8d1ab24b6f861300c75a4f4f3c7d711be6.tar.gz |
Auto merge from 5.1-rep+2
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/include/have_semisync_plugin.inc | 7 | ||||
-rw-r--r-- | mysql-test/include/wait_show_condition.inc | 74 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 52 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_semi_sync.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_show_slave_hosts.result | 17 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_semi_sync.test | 11 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_show_slave_hosts.cnf | 20 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_show_slave_hosts.test | 47 |
9 files changed, 187 insertions, 49 deletions
diff --git a/mysql-test/include/have_semisync_plugin.inc b/mysql-test/include/have_semisync_plugin.inc index 481092f415a..d3b42dbf5fb 100644 --- a/mysql-test/include/have_semisync_plugin.inc +++ b/mysql-test/include/have_semisync_plugin.inc @@ -12,3 +12,10 @@ if (`select LENGTH('$SEMISYNC_MASTER_PLUGIN') = 0`) { skip Need semisync plugins; } + +# +# Check if --plugin-dir was setup for semisync +# +if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$SEMISYNC_PLUGIN_OPT'`) { + --skip SEMISYNC plugin requires that --plugin-dir is set to the semisync plugin dir (either the .opt file does not contain \$SEMISYNC_PLUGIN_OPT or another plugin is in use) +} 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; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 1c14104957d..6f3822cfd85 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1818,25 +1818,39 @@ sub environment_setup { # -------------------------------------------------------------------------- # Add the path where mysqld will find semisync plugins # -------------------------------------------------------------------------- - my $lib_semisync_master_plugin= - mtr_file_exists(vs_config_dirs('plugin/semisync',"libsemisync_master.so"), - "$basedir/plugin/semisync/.libs/libsemisync_master.so", - "$basedir/lib/mysql/plugin/libsemisync_master.so"); - my $lib_semisync_slave_plugin= - mtr_file_exists(vs_config_dirs('plugin/semisync',"libsemisync_slave.so"), - "$basedir/plugin/semisync/.libs/libsemisync_slave.so", - "$basedir/lib/mysql/plugin/libsemisync_slave.so"); - if ($lib_semisync_master_plugin && $lib_semisync_slave_plugin) - { - $ENV{'SEMISYNC_MASTER_PLUGIN'}= basename($lib_semisync_master_plugin); - $ENV{'SEMISYNC_SLAVE_PLUGIN'}= basename($lib_semisync_slave_plugin); - $ENV{'SEMISYNC_PLUGIN_OPT'}= "--plugin-dir=".dirname($lib_semisync_master_plugin); - } - else - { - $ENV{'SEMISYNC_MASTER_PLUGIN'}= ""; - $ENV{'SEMISYNC_SLAVE_PLUGIN'}= ""; - $ENV{'SEMISYNC_PLUGIN_OPT'}="--plugin-dir="; + if (!$opt_embedded_server) { + my $semisync_master_filename; + my $semisync_slave_filename; + if (IS_WINDOWS) + { + $semisync_master_filename = "semisync_master.dll"; + $semisync_slave_filename = "semisync_slave.dll"; + } + else + { + $semisync_master_filename = "libsemisync_master.so"; + $semisync_slave_filename = "libsemisync_slave.so"; + } + my $lib_semisync_master_plugin= + mtr_file_exists(vs_config_dirs('plugin/semisync',$semisync_master_filename), + "$basedir/plugin/semisync/.libs/" . $semisync_master_filename, + "$basedir/lib/mysql/plugin/" . $semisync_master_filename); + my $lib_semisync_slave_plugin= + mtr_file_exists(vs_config_dirs('plugin/semisync',$semisync_slave_filename), + "$basedir/plugin/semisync/.libs/" . $semisync_slave_filename, + "$basedir/lib/mysql/plugin/" . $semisync_slave_filename); + if ($lib_semisync_master_plugin && $lib_semisync_slave_plugin) + { + $ENV{'SEMISYNC_MASTER_PLUGIN'}= basename($lib_semisync_master_plugin); + $ENV{'SEMISYNC_SLAVE_PLUGIN'}= basename($lib_semisync_slave_plugin); + $ENV{'SEMISYNC_PLUGIN_OPT'}= "--plugin-dir=".dirname($lib_semisync_master_plugin); + } + else + { + $ENV{'SEMISYNC_MASTER_PLUGIN'}= ""; + $ENV{'SEMISYNC_SLAVE_PLUGIN'}= ""; + $ENV{'SEMISYNC_PLUGIN_OPT'}="--plugin-dir="; + } } # ---------------------------------------------------- diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result index 08d3241c48f..a353ee73d3f 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result @@ -13,8 +13,8 @@ n 2001 2002 show slave hosts; -Server_id Host Port Rpl_recovery_rank Master_id -2 127.0.0.1 9999 0 1 +Server_id Host Port Master_id +2 127.0.0.1 9999 1 drop table t1; stop slave; create table t2(id int auto_increment primary key, created datetime); diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result index 607b77fbd04..1e220b28d78 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -397,7 +397,7 @@ Rpl_semi_sync_slave_status OFF # Test non-semi-sync slave connect to semi-sync master # set sql_log_bin=0; -INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so'; +INSTALL PLUGIN rpl_semi_sync_master SONAME 'SEMISYNC_MASTER_PLUGIN'; set global rpl_semi_sync_master_timeout= 5000; /* 5s */ set sql_log_bin=1; @@ -416,7 +416,7 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; Variable_name Value include/stop_slave.inc [ reinstall semi-sync slave plugin and disable semi-sync ] -INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so'; +INSTALL PLUGIN rpl_semi_sync_slave SONAME 'SEMISYNC_SLAVE_PLUGIN'; set global rpl_semi_sync_slave_enabled= 0; SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; Variable_name Value diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result b/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result new file mode 100644 index 00000000000..9838d8b08a8 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result @@ -0,0 +1,17 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_PORT,master_user='root'; +START SLAVE IO_THREAD; +SHOW SLAVE HOSTS; +Server_id Host Port Master_id +3 slave2 DEFAULT_PORT 1 +2 SLAVE_PORT 1 +STOP SLAVE IO_THREAD; +SHOW SLAVE HOSTS; +Server_id Host Port Master_id +2 SLAVE_PORT 1 diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index faf961bb580..4900acc1e91 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -1,6 +1,5 @@ source include/have_semisync_plugin.inc; source include/not_embedded.inc; -source include/not_windows.inc; source include/have_innodb.inc; source include/master-slave.inc; @@ -61,7 +60,7 @@ let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', if (`select '$value' = 'No such row'`) { set sql_log_bin=0; - INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so'; + eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN'; set global rpl_semi_sync_master_timeout= 5000; /* 5s */ set sql_log_bin=1; } @@ -126,7 +125,7 @@ let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', V if (`select '$value' = 'No such row'`) { set sql_log_bin=0; - INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so'; + eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN'; set sql_log_bin=1; } enable_query_log; @@ -536,7 +535,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; connection master; set sql_log_bin=0; -INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so'; +replace_result $SEMISYNC_MASTER_PLUGIN SEMISYNC_MASTER_PLUGIN; +eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN'; set global rpl_semi_sync_master_timeout= 5000; /* 5s */ set sql_log_bin=1; set global rpl_semi_sync_master_enabled= 1; @@ -554,7 +554,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; source include/stop_slave.inc; echo [ reinstall semi-sync slave plugin and disable semi-sync ]; -INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so'; +replace_result $SEMISYNC_SLAVE_PLUGIN SEMISYNC_SLAVE_PLUGIN; +eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN'; set global rpl_semi_sync_slave_enabled= 0; SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.cnf b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.cnf new file mode 100644 index 00000000000..288f0132fba --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.cnf @@ -0,0 +1,20 @@ +!include ../my.cnf + +[mysqld.1] +server_id=1 + +[mysqld.2] +server_id=2 +report-host= +report-user= + +[mysqld.3] +server_id=3 +report-host=slave2 +slave-net-timeout=5 + +[ENV] +SLAVE_MYPORT2= @mysqld.3.port +SLAVE_MYSOCK2= @mysqld.3.socket + + diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test new file mode 100644 index 00000000000..9f202487968 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test @@ -0,0 +1,47 @@ +############################################################################### +# Bug#13963 SHOW SLAVE HOSTS is unreliable +# +# 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. +# +# Remove the "Rpl_recovery_rank" column from SHOW SLAVE HOSTS, It is not +# implemented. +####################################################################### +source include/master-slave.inc; +connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT2,); + +connection slave2; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root' +START SLAVE IO_THREAD; +source include/wait_for_slave_io_to_start.inc; + +connection master; +let $show_statement= SHOW SLAVE HOSTS; +let $field= Server_id; +# 3 is server_id of slave2. +let $connection= ='3'; +source include/wait_show_condition.inc; +--replace_result $SLAVE_MYPORT SLAVE_PORT $DEFAULT_MASTER_PORT DEFAULT_PORT +SHOW SLAVE HOSTS; + +connection slave2; +STOP SLAVE IO_THREAD; +source include/wait_for_slave_io_to_stop.inc; + +connection master; +let $show_statement= SHOW SLAVE HOSTS; +let $field= Server_id; +# 3 is server_id of slave2. +let $condition= <> '3'; +# All rows of 'SHOW SLAVE HOSTS' are not equal to 3. It mean that master has +# knew the leave of slave2 and has unregistered it. +let $wait_for_all= 1; +source include/wait_show_condition.inc; +--replace_result $SLAVE_MYPORT SLAVE_PORT +SHOW SLAVE HOSTS; + +source include/master-slave-end.inc; |