From: Andrei Elkin Date: December 17 2012 4:57pm Subject: bzr push into mysql-trunk branch (andrei.elkin:5269 to 5271) List-Archive: http://lists.mysql.com/commits/145522 Message-Id: <201212171657.qBHGv1OR027272@mysql1000.dsl.inet.fi> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 5271 Andrei Elkin 2012-12-17 [merge] merge from 5.6 bugfixing branch. modified: mysql-test/suite/rpl/r/rpl_heartbeat_basic.result mysql-test/suite/rpl/t/rpl_heartbeat_basic.test 5270 Andrei Elkin 2012-12-17 [merge] merge from 5.6 bugfixing branch. modified: mysql-test/extra/rpl_tests/rpl_deadlock.test mysql-test/suite/rpl/r/rpl_deadlock_innodb.result mysql-test/suite/rpl/r/rpl_heartbeat_basic.result mysql-test/suite/rpl/t/rpl_heartbeat_basic.test 5269 magnus.blaudd@stripped 2012-12-17 [merge] Merge 5.6 -> trunk === modified file 'mysql-test/extra/rpl_tests/rpl_deadlock.test' --- a/mysql-test/extra/rpl_tests/rpl_deadlock.test revid:magnus.blaudd@stripped +++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test revid:andrei.elkin@stripped @@ -25,7 +25,8 @@ sync_slave_with_master; SHOW CREATE TABLE t1; SHOW CREATE TABLE t2; SHOW CREATE TABLE t3; -SHOW VARIABLES LIKE 'slave_transaction_retries'; +SELECT @@GLOBAL.slave_transaction_retries; +SELECT @@GLOBAL.innodb_lock_wait_timeout; --source include/stop_slave.inc connection master; @@ -50,7 +51,7 @@ SELECT * FROM t1 FOR UPDATE; # Save variable 'Slave_retried_transactions' before deadlock let $slave_retried_transactions= query_get_value(SHOW GLOBAL STATUS LIKE 'Slave_retried_transactions', Value, 1); --connection slave2 -START SLAVE; +--source include/start_slave.inc --connection slave # Wait until SQL thread blocked: variable 'Slave_retried_transactions' will incremented let $status_var= Slave_retried_transactions; @@ -60,13 +61,12 @@ let $status_var_comparsion= >; --source include/wait_for_status_var.inc SELECT COUNT(*) FROM t2; COMMIT; +source include/check_slave_is_running.inc; sync_with_master; # Check the data SELECT * FROM t1; SELECT * FROM t3; -# Check that no error is reported -source include/check_slave_is_running.inc; --echo # 2) Test lock wait timeout @@ -181,7 +181,9 @@ START SLAVE; let $slave_sql_errno= 1205; # ER_LOCK_TIMEOUT let $show_slave_sql_error= 0; +let $rpl_debug= 1; source include/wait_for_slave_sql_error.inc; +let $rpl_debug= 0; rollback; === modified file 'mysql-test/suite/rpl/r/rpl_deadlock_innodb.result' --- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result revid:magnus.blaudd@stripped +++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result revid:andrei.elkin@stripped @@ -24,9 +24,12 @@ t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, KEY `a` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW VARIABLES LIKE 'slave_transaction_retries'; -Variable_name Value -slave_transaction_retries 2 +SELECT @@GLOBAL.slave_transaction_retries; +@@GLOBAL.slave_transaction_retries +2 +SELECT @@GLOBAL.innodb_lock_wait_timeout; +@@GLOBAL.innodb_lock_wait_timeout +4 include/stop_slave.inc BEGIN; INSERT INTO t1 VALUES (1); @@ -38,18 +41,18 @@ COMMIT; BEGIN; SELECT * FROM t1 FOR UPDATE; a -START SLAVE; +include/start_slave.inc SELECT COUNT(*) FROM t2; COUNT(*) 0 COMMIT; +include/check_slave_is_running.inc SELECT * FROM t1; a 1 SELECT * FROM t3; a 3 -include/check_slave_is_running.inc *** Test lock wait timeout *** include/stop_slave.inc @@ -130,6 +133,17 @@ zero START SLAVE; *** Now the slave must be stopped due to timeout *** include/wait_for_slave_sql_error.inc [errno=1205] +==== BEGIN include/wait_for_slave_sql_error.inc [errno=1205] ==== + con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +.==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ==== +. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +Waiting until 'Slave_SQL_Running' = 'No' [timeout='300', $slave_error_param='1'] +[connection slave] +.==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ==== +. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +==== END include/wait_for_slave_sql_error.inc [errno=1205] ==== + con='slave' warn='1' qlog='1' rlog='1' aborterr='1' rollback; set @@global.slave_transaction_retries= @save.slave_transaction_retries; include/start_slave.inc === modified file 'mysql-test/suite/rpl/r/rpl_heartbeat_basic.result' --- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result revid:magnus.blaudd@stripped +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result revid:andrei.elkin@stripped @@ -229,15 +229,21 @@ RESET SLAVE; RESET MASTER; *** Running slave *** -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD= 3.0; Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives. +SELECT unix_timestamp() into @time_0; include/start_slave.inc +SELECT unix_timestamp() into @time_1; Heartbeat event received *** Stopped slave *** include/stop_slave.inc +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD= 0.1; +Warnings: +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. +Note #### Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives. Number of received heartbeat events while slave stopped: 0 *** Started slave *** @@ -270,26 +276,9 @@ call mtr.add_suppression("Slave SQL.*Dup call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); Heartbeat events are received while sql thread stopped (1 means 'yes'): 1 include/stop_slave.inc -DROP TABLE t1; - -*** Master send to slave *** -CREATE EVENT e1 -ON SCHEDULE EVERY 1 SECOND -DO -BEGIN -UPDATE test.t1 SET a = a + 1 WHERE a < 10; -END| -RESET SLAVE; -RESET MASTER; -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5; -Warnings: -Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives. +DELETE FROM t1; include/start_slave.inc -SET @@global.event_scheduler=1; -Number of received heartbeat events: 0 DROP TABLE t1; -DROP EVENT e1; *** Flush logs on slave *** include/rpl_reset.inc === modified file 'mysql-test/suite/rpl/t/rpl_heartbeat_basic.test' --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test revid:magnus.blaudd@stripped +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test revid:andrei.elkin@stripped @@ -285,25 +285,39 @@ RESET MASTER; # # Testing heartbeat # - -# Check received heartbeat events for running slave +# Check received heartbeat events for running slave. +# It must arrived not ealier than as specified by HEARTBEAT_PERIOD. +# +--let $hb_period= 3.0 --echo *** Running slave *** --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 2 #### -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD= $hb_period; +SELECT unix_timestamp() into @time_0; --source include/start_slave.inc + --connection master --sync_slave_with_master let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $status_var= slave_received_heartbeats; let $status_var_comparsion= >; --source include/wait_for_status_var.inc +SELECT unix_timestamp() into @time_1; +if (`SELECT @time_1 - @time_0 < $hb_period`) +{ + --echo "Heartbeat is received ealier than specified." + --die +} --echo Heartbeat event received --echo # Check received heartbeat events for stopped slave --echo *** Stopped slave *** --source include/stop_slave.inc +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 2 #### +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD= 0.1; + let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); sleep 2; let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); @@ -376,42 +390,12 @@ let $rcvd_heartbeats_after= query_get_va let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1); --echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result --source include/stop_slave.inc -DROP TABLE t1; ---echo - -# Check received heartbeat events while master send events to slave ---echo *** Master send to slave *** ---connection master -# Create the event that will update table t1 every second -DELIMITER |; -CREATE EVENT e1 - ON SCHEDULE EVERY 1 SECOND - DO - BEGIN - UPDATE test.t1 SET a = a + 1 WHERE a < 10; - END| -DELIMITER ;| ---connection slave -RESET SLAVE; -RESET MASTER; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 2 #### -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5; +DELETE FROM t1; --source include/start_slave.inc --connection master -# Enable scheduler -SET @@global.event_scheduler=1; --sync_slave_with_master -let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); -# Wait some updates for table t1 from master -let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5; ---source include/wait_condition.inc -let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); -let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1); ---echo Number of received heartbeat events: $result --connection master DROP TABLE t1; -DROP EVENT e1; --echo # Check received heartbeat events while logs flushed on slave No bundle (reason: useless for push emails).