Commit 6e695369 authored by Sven Sandberg's avatar Sven Sandberg

BUG#37975: wait_for_slave_* should increase the timeout

Problem 1: tests often fail in pushbuild with a timeout when waiting
for the slave to start/stop/receive error.
Fix 1: Updated the wait_for_slave_* macros in the following way:
- The timeout is increased by a factor ten
- Refactored the macros so that wait_for_slave_param does the work for
the other macros.
Problem 2: Tests are often incorrectly written, lacking a
source include/wait_for_slave_to_[start|stop].inc.
Fix 2: Improved the chance to get it right by adding
include/start_slave.inc and include/stop_slave.inc, and updated tests
to use these.
Problem 3: The the built-in test language command
wait_for_slave_to_stop is a misnomer (does not wait for the slave io
thread) and does not give as much debug info in case of failure as
the otherwise equivalent macro
source include/wait_for_slave_sql_to_stop.inc
Fix 3: Replaced all calls to the built-in command by a call to the
macro.
Problem 4: Some, but not all, of the wait_for_slave_* macros had an
implicit connection slave. This made some tests confusing to read,
and made it more difficult to use the macro in circular replication
scenarios, where the connection named master needs to wait.
Fix 4: Removed the implicit connection slave from all
wait_for_slave_* macros, and updated tests to use an explicit
connection slave where necessary.
Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc
were unused. Moreover, using them is difficult and error-prone.
Fix 5: remove these macros.
Problem 6: log_bin_trust_function_creators_basic failed when running
tests because it assumed @@global.log_bin_trust_function_creators=1,
and some tests modified this variable without resetting it to its
original value.
Fix 6: All tests that use this variable have been updated so that
they reset the value at end of test.


mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
  Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
  Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
  Added connection slave since includ/wait_for_slave_sql_to_stop.inc
  does not do that anymore.
mysql-test/extra/rpl_tests/rpl_log.test:
  Replaced start slave+wait_slave_status by start_slave.inc
mysql-test/include/reset_master_and_slave.inc:
  replaced start/stop slave by start_slave.inc/stop_slave.inc
mysql-test/include/sync_slave_io_with_master.inc:
  Improved comments and error message.
mysql-test/include/wait_for_slave_io_to_stop.inc:
  Refactored to use wait_for_slave_param.inc.
  Removed connection slave.
mysql-test/include/wait_for_slave_param.inc:
  - Improved usage instructions
  - Added more debug info in case of timeout
  - Added parameters $slave_param_comparison, $slave_timeout,
  $slave_keep_connection, $slave_error_message
mysql-test/include/wait_for_slave_sql_error.inc:
  Refactored to use wait_for_slave_param.inc.
  Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_start.inc:
  Refactored to use wait_for_slave_param.inc.
  Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_stop.inc:
  Refactored to use wait_for_slave_param.inc.
  Removed connection slave.
mysql-test/include/wait_for_slave_to_start.inc:
  Refactored to use wait_for_slave_param.inc.
  Removed connection slave.
mysql-test/include/wait_for_slave_to_stop.inc:
  Refactored to use wait_for_slave_param.inc.
  Removed connection slave.
mysql-test/include/wait_show_pattern.inc:
  Removed unused (and error-prone) file
mysql-test/include/wait_slave_status.inc:
  Removed unused (and error-prone) file
mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test:
  Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_bug26395.test:
  Replace stop slave by stop_slave.inc
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test:
  Replace start/stop slave by start_slave.inc/stop_slave.inc.
  Replace wait_for_slave_param by wait_for_slave_sql_to_stop.inc.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
  Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
  Replace wait_slave_status by start_slave.inc
mysql-test/suite/rpl/t/rpl_idempotency.test:
  Added connection slave since wait_for_slave_sql_to_stop.inc does not
  do that any more.
mysql-test/suite/rpl/t/rpl_incident.test:
  Replaced wait_for_slave_to_stop by wait_for_slave_sql_to_stop.inc
mysql-test/suite/rpl/t/rpl_init_slave.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
  Replaced save_master_pos;connection slave;sync_with_master by
  sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_log_pos.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
  Replaced wait_for_slave_param by other wait_for_slave_* macros.
mysql-test/suite/rpl/t/rpl_packet.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_until.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
  Replaced save_master_pos;connection slave;sync_with_master by
  sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_server_id1.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_grp_exec.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_status.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_sp.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_sp_effects.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_stm_until.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
  Replaced save_master_pos;connection slave;sync_with_master by
  sync_slave_with_master.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
  Replaced start slave by start_slave.inc.
  Added explicit connection slave since wait_for_slave_sql_to_stop.inc
  does not do that anymore.
mysql-test/t/disabled.def:
  Disabled failing test.
mysql-test/t/func_time.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant2.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/innodb_notembedded.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/log_bin_trust_function_creators_func.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
  Clean up at end of test by dropping the created user.
mysql-test/t/query_cache.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/query_cache_notembedded.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/rpl_init_slave_func.test:
  Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/t/timezone2.test:
  Restore @@global.log_bin_trust_function_creators at end of test.
parent d034ae59
......@@ -497,7 +497,7 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
--echo ********************************************
--echo
connection slave;
wait_for_slave_to_stop;
source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
......@@ -554,7 +554,7 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
--echo ********************************************
--echo
connection slave;
wait_for_slave_to_stop;
source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
......@@ -697,7 +697,7 @@ SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
# Remove below once fixed
#***************************
connection slave;
wait_for_slave_to_stop;
source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
......@@ -763,7 +763,7 @@ SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
--echo ********************************************
--echo
connection slave;
wait_for_slave_to_stop;
source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
......@@ -840,7 +840,7 @@ SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
--echo *****************
--echo
connection slave;
wait_for_slave_to_stop;
source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
......
......@@ -94,7 +94,7 @@ SELECT * FROM t2 ORDER BY a;
--echo *** Start Slave ***
connection slave;
START SLAVE;
wait_for_slave_to_stop;
source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
......@@ -429,6 +429,7 @@ set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
......
......@@ -9,10 +9,8 @@
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
# We wait for the slave to have written all he wants to the binlog
# (otherwise RESET MASTER may come too early).
save_master_pos;
connection slave;
sync_with_master;
stop slave;
sync_slave_with_master;
source include/stop_slave.inc;
reset master;
reset slave;
# We are going to read the slave's binlog which contains file_id (for some LOAD
......@@ -81,17 +79,14 @@ select * from t1 order by 1 asc;
save_master_pos;
connection slave;
# Note that the above 'slave start' will cause a 3rd rotate event (a fake one)
# to go into the relay log (the master always sends a fake one when replication
# starts).
start slave;
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%';
--source include/wait_slave_status.inc
source include/start_slave.inc;
sync_with_master;
#check t1 on slave to ensure whether it's identical with on master
select * from t1 order by 1 asc;
flush logs;
stop slave;
source include/stop_slave.inc;
source include/start_slave.inc;
connection master;
# Create some entries for second log
......@@ -104,10 +99,7 @@ source include/show_binlog_events.inc;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events in 'master-bin.000002';
show binary logs;
save_master_pos;
connection slave;
start slave;
sync_with_master;
sync_slave_with_master;
show binary logs;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
--replace_column 2 # 5 #
......
--echo **** Resetting master and slave ****
connection slave;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
RESET SLAVE;
connection master;
RESET MASTER;
connection slave;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/start_slave.inc;
......@@ -7,19 +7,30 @@
#
# ==== Usage ====
#
# source include/sync_slave_io_with_master.inc;
#
# Syncs to the current position on master, as found by SHOW MASTER
# STATUS.
#
# Must be called on the master.
# Must be called on the master. Will change connection to the slave.
#
# Parameters to this macro are $slave_timeout and
# $slave_keep_connection. See wait_for_slave_param.inc for
# descriptions.
let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1);
let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1);
connection slave;
let $slave_error_message= Failed while waiting for slave IO thread to sync;
let $slave_param= Master_Log_File;
let $slave_param_value= $_master_file;
source include/wait_for_slave_param.inc;
let $slave_param= Read_Master_Log_Pos;
let $slave_param_value= $_master_pos;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
###################################################
#Author: Jeb
#Date: 2007-06-11
#Purpose: used for io errors on the slave. If Slave gets an io
# error, the io trhead should stop
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for
# sql threads to stop
# 3) If loops too long die.
####################################################
connection slave;
let $my_show= SHOW SLAVE STATUS;
let $sql_running= Slave_IO_Running;
let $row_number= 1;
let $run= 1;
let $counter= 300;
while ($run)
{
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
if (`SELECT '$io_result' = 'No'`){
let $run= 0;
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave IO thread to stop"
query_vertical SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
# ==== Purpose ====
#
# Waits until the IO thread of the current connection has stopped, or
# until a timeout is reached.
#
# ==== Usage ====
#
# source include/wait_for_slave_io_to_stop.inc;
#
# Parameters to this macro are $slave_timeout and
# $slave_keep_connection. See wait_for_slave_param.inc for
# descriptions.
let $slave_param= Slave_IO_Running;
let $slave_param_value= No;
let $slave_error_message= Failed while waiting for slave IO thread to stop;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
# include/wait_for_slave_param.inc
# ==== Purpose ====
#
# SUMMARY
# Waits until SHOW SLAVE STATUS has returned a specified value, or
# until a timeout is reached.
#
# Waits until SHOW SLAVE STATUS has returned a spicified value.
#
# USAGE
# ==== Usage ====
#
# let $slave_param= Slave_SQL_Running;
# let $slave_param_value= No;
# --source include/slave_wait_param.inc
#
# Parameters:
#
# $slave_param, $slave_param_value
# This macro will wait until the column of the output of SHOW SLAVE
# STATUS named $slave_param gets the value $slave_param_value. See
# the example above.
#
# $slave_param_comparison
# By default, this file waits until $slave_param becomes equal to
# $slave_param_value. If you want to wait until $slave_param
# becomes *unequal* to $slave_param_value, set this parameter to the
# string '!=', like this:
# let $slave_param_comparison= !=;
#
# $slave_timeout
# The default timeout is 5 minutes. You can change the timeout by
# setting $slave_timeout. The unit is tenths of seconds.
#
# $slave_keep_connection
# If the timeout is reached, debug info is given by calling SHOW
# SLAVE STATUS, SHOW PROCESSLIST, and SHOW BINLOG EVENTS. By
# default (assuming the current connection is slave), a 'connection
# master' is then issued, and the same information is printed again
# on the master host. You can avoid switching to master (and thus
# suppress debug info on master too) by setting
# $slave_keep_connection to 1.
#
# $slave_error_message
# If set, this is printed when a timeout occurs. This is primarily
# intended to be used by other wait_for_slave_* macros, to indicate
# what the purpose of the wait was. (A very similar error message is
# given by default, but the wait_for_slave_* macros use this to give
# an error message identical to that in previous versions, so that
# errors are easier searchable in the pushbuild history.)
let $_slave_timeout_counter= $slave_timeout;
if (!$_slave_timeout_counter)
{
let $_slave_timeout_counter= 3000;
}
let $slave_wait_param_counter= 300;
let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
while (`select "$slave_value" != "$slave_param_value"`)
let $_slave_param_comparison= $slave_param_comparison;
if (`SELECT '$_slave_param_comparison' = ''`)
{
dec $slave_wait_param_counter;
if (!$slave_wait_param_counter)
let $_slave_param_comparison= =;
}
let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value')`)
{
if (!$_slave_timeout_counter)
{
--echo **** ERROR: failed while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value ****
if (`SELECT '$slave_error_message' != ''`)
{
--echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value
query_vertical show slave status;
--echo Message: $slave_error_message
}
--echo Note: the following output may have changed since the failure was detected
--echo **** Showing SLAVE STATUS, PROCESSLIST, and BINLOG EVENTS on slave ****
query_vertical SHOW SLAVE STATUS;
SHOW PROCESSLIST;
let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
eval SHOW BINLOG EVENTS IN '$binlog_name';
if (!$slave_keep_connection) {
let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
let $master_binlog_name_sql= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1);
--echo **** Showing MASTER STATUS, PROCESSLIST, and BINLOG EVENTS on master ****
--echo [on master]
connection master;
query_vertical SHOW MASTER STATUS;
SHOW PROCESSLIST;
eval SHOW BINLOG EVENTS IN '$master_binlog_name_sql';
if (`SELECT '$master_binlog_name_io' != '$master_binlog_name_sql'`)
{
eval SHOW BINLOG EVENTS IN '$master_binlog_name_io';
}
}
exit;
}
dec $_slave_timeout_counter;
sleep 0.1;
let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
}
###################################################
#Author: Sven
#Date: 2007-10-09
#Purpose: Wait until the slave has an error in the
# sql thread, as indicated by
# "SHOW SLAVE STATUS", or at most 30
# seconds.
#Details:
# 1) Fill in and setup variables
# 2) loop, looking for sql error on slave
# 3) If it loops too long, die.
####################################################
connection slave;
let $row_number= 1;
let $run= 1;
let $counter= 300;
# ==== Purpose ====
#
# Waits until the SQL thread of the current connection has got an
# error, or until a timeout is reached.
#
# ==== Usage ====
#
# source include/wait_for_slave_sql_error.inc;
#
# Parameters to this macro are $slave_timeout and
# $slave_keep_connection. See wait_for_slave_param.inc for
# descriptions.
while ($run)
{
let $sql_result= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, $row_number);
let $run= `SELECT '$sql_result' = '0'`;
if ($run) {
real_sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave to produce an error in its sql thread"
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
query_vertical SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
}
let $old_slave_param_comparison= $slave_param_comparison;
let $slave_param= Last_SQL_Errno;
let $slave_param_comparison= !=;
let $slave_param_value= 0;
let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
let $slave_param_comparison= $old_slave_param_comparison;
###################################################
#Author: Mats (based on file written by Jeb)
#Date: 2008-05-06
#Purpose: To wait for slave SQL thread to start
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for both
# io and sql threads to start
# 3) If loops too long die.
####################################################
connection slave;
let $row_number= 1;
let $run= 1;
let $counter= 300;
while ($run)
{
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
if (`SELECT '$sql_result' = 'Yes'`){
let $run= 0;
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave SQL to start"
query_vertical SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
# ==== Purpose ====
#
# Waits the SQL thread of the current connection has started, or until
# a timeout is reached.
#
# ==== Usage ====
#
# source include/wait_for_slave_sql_to_start.inc;
#
# Parameters to this macro are $slave_timeout and
# $slave_keep_connection. See wait_for_slave_param.inc for
# descriptions.
let $slave_param= Slave_SQL_Running;
let $slave_param_value= Yes;
let $slave_error_message= Failed while waiting for slave SQL to start;
source include/wait_for_slave_param.inc;
###################################################
#Author: Jeb
#Date: 2007-06-11
#Purpose: used for SQL errors on the slave. If Slave gets a sql
# error, the SQL trhead should stop
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for
# sql threads to stop
# 3) If loops too long die.
# ==== Purpose ====
#
# INPUT:
# $timeout_counter Number of 1/10 sec to wait
# $keep_connection Do not do any "connect"
####################################################
if (!$keep_connection)
{
connection slave;
}
let $row_number= 1;
let $run= 1;
let $counter = $timeout_counter;
if (!$counter)
{
let $counter= 3000;
}
# Waits the SQL thread of the current connection has stopped, or until
# a timeout is reached.
#
# ==== Usage ====
#
# source include/wait_for_slave_sql_to_stop.inc;
#
# Parameters to this macro are $slave_timeout and
# $slave_keep_connection. See wait_for_slave_param.inc for
# descriptions.
while ($run)
{
if (!$keep_connection)
{
if (!$counter)
{
let $binlog_pos = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
let $binlog_file = query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
}
}
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
if (`SELECT '$sql_result' = 'No'`){
let $run= 0;
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave SQL thread to stop"
if (!$keep_connection)
{
--echo [on master]
connection master;
--echo **** Note that the binlog positions are not read atomically: ****
--echo **** the replication might in reality have progressed further ****
eval SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_pos LIMIT 5;
--echo [on slave]
connection slave;
}
--echo **** Note that the process list might have changed since the ****
--echo **** failure was detected ****
SHOW PROCESSLIST;
--echo **** Note that the binlog positions are not read atomically, so ****
--echo **** there is a small risk that the binlog status is incorrect ****
query_vertical SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
let $slave_param= Slave_SQL_Running;
let $slave_param_value= No;
let $slave_error_message= Failed while waiting for slave SQL thread to stop;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
###################################################
#Author: Jeb
#Date: 2007-06-11
#Purpose: To wait a brief time for slave to start
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for both
# io and sql threads to start
# 3) If loops too long die.
####################################################
connection slave;
let $row_number= 1;
let $run= 1;
let $counter= 300;
# ==== Purpose ====
#
# Waits until both the IO and SQL threads of the current connection
# have started, or until a timeout is reached.
#
# ==== Usage ====
#
# source include/wait_for_slave_to_start.inc;
#
# Parameters to this macro are $slave_timeout and
# $slave_keep_connection. See wait_for_slave_param.inc for
# descriptions.
while ($run)
{
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
if (`SELECT '$io_result' = 'Yes'`){
let $slave_error_message= Failed while waiting for slave to start;
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
if (`SELECT '$sql_result' = 'Yes'`){
let $run= 0;
}
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave to start"
query_vertical SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
let $slave_param= Slave_IO_Running;
let $slave_param_value= Yes;
source include/wait_for_slave_param.inc;
let $slave_param= Slave_SQL_Running;
let $slave_param_value= Yes;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
###################################################
#Author: Jeb
#Date: 2007-06-11
#Purpose: To replace the mysqltest.c executable
# wait_for_slave_to_stop function and
# return this to the test language.
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for both
# io and sql threads to stop
# 3) If loops too long die.
####################################################
connection slave;
let $row_number= 1;
let $run= 1;
let $counter= 300;
# ==== Purpose ====
#
# Waits until both the IO and SQL threads of the current connection
# have stopped, or until a timeout is reached.
#
# ==== Usage ====
#
# source include/wait_for_slave_to_stop.inc;
#
# Parameters to this macro are $slave_timeout and
# $slave_keep_connection. See wait_for_slave_param.inc for
# descriptions.
while ($run)
{
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
if (`SELECT '$io_result' = 'No'`){
let $slave_error_message= Failed while waiting for slave to stop;
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
if (`SELECT '$sql_result' = 'No'`){
let $run= 0;
}
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave to stop"
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
query_vertical SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
let $slave_param= Slave_IO_Running;
let $slave_param_value= No;
source include/wait_for_slave_param.inc;
let $slave_param= Slave_SQL_Running;
let $slave_param_value= No;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
# include/wait_show_pattern.inc
#
# SUMMARY
#
# Waits until output produced by SHOW statement which particular type is
# specified as parameter matches certain pattern or maximum time reached.
#
# NOTES
#
# Only the first row produced by the parameter statement is checked.
#
# USAGE
#
# let $show_type= <Tail of SHOW statement>;
# let $show_pattern= 'Pattern to be used for LIKE matching';
# --source wait_show_pattern.inc
#
# EXAMPLES
#
# alter_table-big.test, wait_slave_status.inc
#
# SEE ALSO
#
# wait_slave_status.inc, wait_condition.inc (>=5.1)
#
###############################################################################
--disable_query_log
# We accept to wait maximum 30 seconds (0.2 sec/loop).
let $wait_counter= 150;
while ($wait_counter)
{
let $result= `SHOW $show_type`;
let $success= `SELECT "$result" LIKE $show_pattern`;
if ($success)
{
let $wait_counter= 0;
}
if (!$success)
{
real_sleep 0.2;
dec $wait_counter;
}
}
if (!$success)
{
echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result');
}
--enable_query_log
# include/wait_slave_status.inc
#
# Created by Matthias Leich
#
# SUMMARY
#
# Waits until slave has reached certain state or maximum time reached.
#
# (This script will not work, when the SHOW command delivers more than one
# result record, because only the first record will be caught.)
#
# USAGE
#
# Set $result_pattern in test file and source this file:
#
# let $result_pattern= <pattern used for LIKE on the result of
# SHOW STATUS SLAVE>
# --include wait_slave_status.inc
#
# EXAMPLE
#
# The script rpl_until.test:
# ...
# --replace_result $MASTER_MYPORT MASTER_MYPORT
# --replace_column 1 # 9 # 23 # 33 #
# --vertical_results show slave status;
#
# outputs
# show slave status;
# Slave_IO_State #
# Master_Host 127.0.0.1
# Master_User root
# Master_Port MASTER_MYPORT
# Connect_Retry 1
# Master_Log_File master-bin.000001
# Read_Master_Log_Pos 776
# Relay_Log_File slave-relay-bin.000004
# Relay_Log_Pos #
# Relay_Master_Log_File master-bin.000001
# Slave_IO_Running Yes
# Slave_SQL_Running No
# Replicate_Do_DB
# Replicate_Ignore_DB
# Replicate_Do_Table
# Replicate_Ignore_Table
# Replicate_Wild_Do_Table
# Replicate_Wild_Ignore_Table
# Last_Errno 0
# Last_Error
# Skip_Counter 0
# Exec_Master_Log_Pos 319
# Relay_Log_Space #
# Until_Condition Master
# Until_Log_File master-bin.000001
# Until_Log_Pos 319
# Master_SSL_Allowed No
# Master_SSL_CA_File
# Master_SSL_CA_Path
# Master_SSL_Cert
# Master_SSL_Cipher
# Master_SSL_Key
# Seconds_Behind_Master #
#
# The main problem with the "show slave status;" in rpl_until is, that
# depending on the total test engine power and the current load caused by
# other processes, the expected slave status might be not reached though
# it will happen in maybe some seconds.
#
# The typical problem with rpl_until is that Slave_IO_Running is "No"
# instead of "Yes".
#
# The expected result follows the LIKE pattern:
#
# let $result_pattern= '%127.0.0.1%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%';
#
# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001".
#
# How to get this pattern ?
#
# Any lines "--replace_result ..." and "--replace_colum ..." just before
# the SHOW TABLE STATUS and of course the expected result itself
# show us columns where the content must be unified, because it is non
# deterministic or it depends on the current test environment.
#
# Unfortunately "--replace_result ..." and "--replace_colum ..." do not
# affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`;
# Therefore such content must be covered by '%'.
#
# Please be careful. A more simple pattern might be dangerous, because we
# might get "wrong" matches. Example: There might be several "Yes" and "No"
# within one result row.
#
###############################################################################
# We do not want to print the auxiliary commands, because they are not of
# interest and their amount will vary depending how fast we get the
# desired state.
--disable_query_log
# The protocol should show
# - the setting of $result_pattern and
# - that this file is sourced ,
# because this increases the chance to use the protocol as replay script.
eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
SELECT '--source include/wait_slave_status.inc' AS "";
let $show_type= SLAVE STATUS;
let $show_pattern= $result_pattern;
--enable_query_log
--source include/wait_show_pattern.inc
if (!$success)
{
let $message= ! Attention: Timeout in wait_slave_status.inc.
| Possible reasons with decreasing probability:
| - The LIKE pattern is wrong, because the
| testcase was altered or the layout of the
| SHOW SLAVE STATUS result set changed.
| - There is a new bug within the replication.
| - We met an extreme testing environment and timeout is
| too small.;
--source include/show_msg80.inc
--echo DEBUG INFO START (wait_slave_status.inc):
--echo $result_pattern
--vertical_results
show slave status;
--echo DEBUG INFO END
}
......@@ -1078,6 +1078,7 @@ Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestamp
select time_format('100:00:00', '%H %k %h %I %l');
time_format('100:00:00', '%H %k %h %I %l')
100 100 04 04 4
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01');
......@@ -1121,6 +1122,7 @@ call t_sysdate();
@a != @b
1
drop procedure t_sysdate;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
select timestampdiff(month,'2004-09-11','2004-09-11');
timestampdiff(month,'2004-09-11','2004-09-11')
0
......
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
drop table if exists t1;
drop database if exists mysqltest;
......@@ -1351,4 +1352,4 @@ DROP PROCEDURE sp3;
DROP USER 'userbug33464'@'localhost';
use test;
DROP DATABASE dbbug33464;
End of 5.1 tests
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
......@@ -365,6 +365,7 @@ insert into mysql.user select * from t1;
drop table t1, t2;
drop database TESTDB;
flush privileges;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
grant all privileges on test.* to `a@`@localhost;
grant execute on * to `a@`@localhost;
......@@ -380,7 +381,7 @@ drop function f2;
drop table t2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database if exists mysqltest_1;
drop database if exists mysqltest_2;
drop user mysqltest_u1@localhost;
......
drop table if exists t1;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (col1 integer primary key, col2 integer) engine=innodb;
insert t1 values (1,100);
......@@ -19,4 +20,4 @@ rollback;
rollback;
drop table t1;
drop function f1;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
......@@ -3,6 +3,7 @@ drop table if exists t1;
## Creating new user tt ##
CREATE user tt@localhost;
## Setting value of variable to 0 ##
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET @@global.log_bin_trust_function_creators = 0;
## Creating new table t2 ##
create table t2 (a INT);
......@@ -69,3 +70,5 @@ drop function f1;
## Dropping table t1 & t2 ##
drop table t1,t2;
## Disconnecting both the connections ##
DROP USER tt@localhost;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
......@@ -1116,12 +1116,13 @@ create procedure `p1`()
begin
select a, f1() from t1;
end//
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
call p1()//
a f1()
1 2
2 2
SET GLOBAL log_bin_trust_function_creators = 0;
SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
drop procedure p1//
drop function f1//
drop table t1//
......
......@@ -314,6 +314,7 @@ drop procedure f2;
drop procedure f3;
drop procedure f4;
drop table t1;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
reset query cache;
drop function if exists f1;
......@@ -346,7 +347,7 @@ id
drop table t1;
drop function f1;
set GLOBAL query_cache_size=0;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
DROP DATABASE IF EXISTS bug30269;
FLUSH STATUS;
CREATE DATABASE bug30269;
......
......@@ -269,6 +269,7 @@ select * from t1;
convert_tz(NULL, NULL, NULL)
NULL
drop table t1;
SET @old_log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (ldt datetime, udt datetime);
create function f1(i datetime) returns datetime
......@@ -284,7 +285,7 @@ ldt ldt2
2006-04-19 16:30:00 2006-04-19 16:30:00
drop table t1;
drop function f1;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (t TIMESTAMP);
INSERT INTO t1 VALUES (NULL), (NULL);
......
......@@ -51,6 +51,6 @@ enable_warnings;
remove_file $MYSQLD_DATADIR/slave-relay-bin.000001;
remove_file $MYSQLD_DATADIR/slave-relay-bin.index;
stop slave sql_thread;
let $keep_connection=1;
let $slave_keep_connection=1;
source include/wait_for_slave_sql_to_stop.inc;
......@@ -21,7 +21,7 @@ a
1
[on slave]
==== Verify results on slave ====
STOP SLAVE;
include/stop_slave.inc
SELECT "" AS Slave_IO_State;
Slave_IO_State
......
......@@ -92,7 +92,7 @@ Master D 4 D
* Do failure for C and then make new connection B->D *
STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;
include/start_slave.inc
INSERT INTO t1 VALUES(6,'C',2);
INSERT INTO t1(b,c) VALUES('B',2);
INSERT INTO t1(b,c) VALUES('A',2);
......@@ -119,7 +119,7 @@ Master D 8 D
STOP SLAVE;
STOP SLAVE;
CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS;
START SLAVE;
include/start_slave.inc
* Check data inserted before failure *
SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
......@@ -166,7 +166,7 @@ Master D 12 D
*** Testing restoring scheme A->B->C->D->A after failure ***
* Remove wrong event from C and restore B->C->D *
STOP SLAVE;
include/stop_slave.inc
DELETE FROM t1 WHERE a = 6;
START SLAVE;
RESET MASTER;
......
......@@ -18,11 +18,7 @@ start slave;
stop slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT;
start slave;
let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%' ;
--source include/wait_slave_status.inc
include/start_slave.inc
FLUSH LOGS;
SHOW SLAVE STATUS;
Slave_IO_State #
......
......@@ -103,10 +103,10 @@ DROP PROCEDURE just_log;
DROP PROCEDURE calc_and_log;
DROP FUNCTION log_rows;
**** Resetting master and slave ****
STOP SLAVE;
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
START SLAVE;
include/start_slave.inc
#### 2. Using mixed mode ####
==== 2.1. Checking a procedure ====
**** On Master ****
......
......@@ -5,8 +5,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
set global max_connections=151;
stop slave;
start slave;
include/stop_slave.inc
include/start_slave.inc
show variables like 'init_slave';
Variable_name Value
init_slave set global max_connections=500
......@@ -25,6 +25,6 @@ set global init_connect="set @c=1";
show variables like 'init_connect';
Variable_name Value
init_connect set @c=1
stop slave;
include/stop_slave.inc
set global init_connect= @my_global_init_connect;
set global max_connections= default;
......@@ -7,7 +7,7 @@ start slave;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
stop slave;
include/stop_slave.inc
change master to master_log_pos=75;
SHOW SLAVE STATUS;
Slave_IO_State #
......@@ -49,7 +49,7 @@ Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
start slave;
stop slave;
include/stop_slave.inc
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
......
......@@ -8,8 +8,8 @@ drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________
create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
SET @@global.max_allowed_packet=1024;
SET @@global.net_buffer_length=1024;
STOP SLAVE;
START SLAVE;
include/stop_slave.inc
include/start_slave.inc
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
......@@ -27,8 +27,8 @@ SLAVE_RUNNING ON
drop database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
SET @@global.max_allowed_packet=4096;
SET @@global.net_buffer_length=4096;
STOP SLAVE;
START SLAVE;
include/stop_slave.inc
include/start_slave.inc
CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
show slave status;
......
......@@ -423,10 +423,10 @@ a b c
**** On Master ****
DELETE FROM t1;
**** Resetting master and slave ****
STOP SLAVE;
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
START SLAVE;
include/start_slave.inc
**** On Master ****
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
**** On Master ****
......
......@@ -423,10 +423,10 @@ a b c
**** On Master ****
DELETE FROM t1;
**** Resetting master and slave ****
STOP SLAVE;
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
START SLAVE;
include/start_slave.inc
**** On Master ****
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
**** On Master ****
......
......@@ -16,6 +16,6 @@ INSERT INTO t1 VALUES (1);
[on slave]
Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables
==== Clean up ====
STOP SLAVE;
include/stop_slave.inc
[on master]
DROP TABLE t1;
......@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
include/stop_slave.inc
reset master;
reset slave;
reset master;
......@@ -113,11 +113,7 @@ Aberdeen
Abernathy
aberrant
aberration
start slave;
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
--source include/wait_slave_status.inc
include/start_slave.inc
select * from t1 order by 1 asc;
word
Aarhus
......@@ -190,7 +186,8 @@ Abernathy
aberrant
aberration
flush logs;
stop slave;
include/stop_slave.inc
include/start_slave.inc
create table t2 (n int)ENGINE=MyISAM;
insert into t2 values (1);
show binlog events from <binlog_start>;
......@@ -220,7 +217,6 @@ show binary logs;
Log_name File_size
master-bin.000001 1540
master-bin.000002 516
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1638
......
......@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
include/stop_slave.inc
reset master;
reset slave;
reset master;
......@@ -113,11 +113,7 @@ Aberdeen
Abernathy
aberrant
aberration
start slave;
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
--source include/wait_slave_status.inc
include/start_slave.inc
select * from t1 order by 1 asc;
word
Aarhus
......@@ -190,7 +186,8 @@ Abernathy
aberrant
aberration
flush logs;
stop slave;
include/stop_slave.inc
include/start_slave.inc
create table t2 (n int)ENGINE=InnoDB;
insert into t2 values (1);
show binlog events from <binlog_start>;
......@@ -220,7 +217,6 @@ show binary logs;
Log_name File_size
master-bin.000001 1456
master-bin.000002 474
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1536
......
......@@ -13,4 +13,5 @@ select count(*) from t1;
count(*)
70
drop table t1;
include/stop_slave.inc
drop table t1;
......@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
include/stop_slave.inc
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
drop table t1;
......@@ -149,7 +149,7 @@ Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
start slave;
stop slave;
include/stop_slave.inc
start slave sql_thread until master_log_file='master-bin.000001', master_log_pos=740;
SHOW SLAVE STATUS;
Slave_IO_State #
......
......@@ -44,9 +44,9 @@ a b
SELECT * FROM t2 ORDER BY a;
a b
1 AA_for_row_or_YY_for_stmt_mixed
STOP SLAVE;
include/stop_slave.inc
RENAME TABLE t3_bak TO t3;
START SLAVE;
include/start_slave.inc
TRUNCATE t1;
TRUNCATE t2;
TRUNCATE t3;
......@@ -78,9 +78,9 @@ SELECT * FROM t1 ORDER BY a;
a b
SELECT * FROM t2 ORDER BY a;
a b
STOP SLAVE;
include/stop_slave.inc
RENAME TABLE t3_bak TO t3;
START SLAVE;
include/start_slave.inc
TRUNCATE t1;
TRUNCATE t2;
TRUNCATE t3;
......@@ -116,8 +116,8 @@ SELECT * FROM t1 ORDER BY a;
a b
SELECT * FROM t2 ORDER BY a;
a b
STOP SLAVE;
include/stop_slave.inc
RENAME TABLE t3_bak TO t3;
START SLAVE;
include/start_slave.inc
*** Clean up ***
DROP TABLE t1,t2,t3;
......@@ -166,7 +166,7 @@ BEGIN
UPDATE t3 SET a =2, b = 'master only';
END|
**** On Slave ****
STOP SLAVE;
include/stop_slave.inc
**** On Master ****
UPDATE t1 SET a = 2, b = 'master only' WHERE a = 1;
DROP TRIGGER tr1;
......@@ -188,7 +188,7 @@ a b
3 master/slave
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a b
1 master/slave
......@@ -208,7 +208,7 @@ CREATE TABLE t4 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t5 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb;
**** On Slave ****
STOP SLAVE;
include/stop_slave.inc
*** On Master ***
BEGIN;
INSERT INTO t4 VALUES (2, 'master only');
......@@ -234,7 +234,7 @@ a b
3 master/slave
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
......@@ -245,7 +245,7 @@ SELECT * FROM t6 ORDER BY a;
a b
3 master/slave
**** On Slave ****
STOP SLAVE;
include/stop_slave.inc
*** On Master ***
BEGIN;
INSERT INTO t4 VALUES (6, 'master only');
......@@ -277,7 +277,7 @@ a b
7 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10;
START SLAVE;
include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
......@@ -287,7 +287,7 @@ a b
SELECT * FROM t6 ORDER BY a;
a b
3 master/slave
STOP SLAVE;
include/stop_slave.inc
SET AUTOCOMMIT=0;
INSERT INTO t4 VALUES (4, 'master only');
INSERT INTO t5 VALUES (4, 'master only');
......@@ -323,7 +323,7 @@ a b
7 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
......@@ -341,7 +341,7 @@ DROP TABLE t4, t5, t6;
*** On Master ***
CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam;
*** On Slave ***
STOP SLAVE;
include/stop_slave.inc
*** On Master ***
SET SESSION BINLOG_FORMAT=STATEMENT;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
......@@ -352,7 +352,7 @@ a b
3 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
include/start_slave.inc
SELECT * FROM t10 ORDER BY a;
a b
DROP TABLE t10;
......@@ -8,9 +8,9 @@ start slave;
[on master]
GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
[on slave]
STOP SLAVE;
include/stop_slave.inc
CHANGE MASTER TO master_user='rpl', master_password='rpl';
START SLAVE;
include/start_slave.inc
==== Do replication as new user ====
[on master]
CREATE TABLE t1 (n INT);
......@@ -25,7 +25,7 @@ DROP USER rpl@127.0.0.1;
FLUSH PRIVILEGES;
[on slave]
==== Restart slave without privileges =====
STOP SLAVE;
include/stop_slave.inc
START SLAVE;
==== Verify that Slave_IO_Running = No ====
Slave_IO_Running = No (should be No)
......
......@@ -191,11 +191,15 @@ begin
return unix_timestamp();
end|
ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_routine_creators=1;
Warnings:
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=1;
create function fn2()
returns int
......@@ -549,8 +553,14 @@ insert into t values (1);
return 0;
end
master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`()
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=0;
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
Warnings:
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
Warnings:
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database mysqltest;
drop database mysqltest2;
use test;
......
......@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
drop procedure if exists p1;
drop procedure if exists p2;
drop function if exists f1;
......@@ -275,5 +276,5 @@ E
drop table t2;
drop procedure sp_bug26199;
drop function sf_bug26199;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
end of the tests
......@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
include/stop_slave.inc
reset master;
reset slave;
reset master;
......@@ -109,11 +109,7 @@ Aberdeen
Abernathy
aberrant
aberration
start slave;
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
--source include/wait_slave_status.inc
include/start_slave.inc
select * from t1 order by 1 asc;
word
Aarhus
......@@ -186,7 +182,8 @@ Abernathy
aberrant
aberration
flush logs;
stop slave;
include/stop_slave.inc
include/start_slave.inc
create table t2 (n int)ENGINE=MyISAM;
insert into t2 values (1);
show binlog events from <binlog_start>;
......@@ -209,7 +206,6 @@ show binary logs;
Log_name File_size
master-bin.000001 1347
master-bin.000002 392
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1450
......
......@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
include/stop_slave.inc
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
drop table t1;
......@@ -149,7 +149,7 @@ Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
start slave;
stop slave;
include/stop_slave.inc
start slave until master_log_file='master-bin.000001', master_log_pos=776;
SHOW SLAVE STATUS;
Slave_IO_State #
......
......@@ -40,10 +40,10 @@ SET @user_num = 10;
SET @user_text = 'Alunda';
[on master]
**** Resetting master and slave ****
STOP SLAVE;
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
START SLAVE;
include/start_slave.inc
[on slave]
SET @@global.init_slave = 'ant';
[on master]
......
......@@ -23,7 +23,7 @@
#
# To simulate the slave correctly, we wait until everything up to but
# not including the XID is replicated. This has to be done with
# include/wait_for_slave_io_to_sync.inc, not sync_slave_with_master,
# include/sync_slave_io_with_master.inc, not sync_slave_with_master,
# since the latter waits until the slave *SQL* thread has caught up
# with the master's position, which it will never do.
#
......@@ -70,8 +70,7 @@ sync_with_master 0;
--echo ==== Verify results on slave ====
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
let $tmp= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1);
eval SELECT "$tmp" AS Slave_IO_State;
let $tmp= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
......
......@@ -57,8 +57,7 @@ SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;
--source include/wait_for_slave_to_start.inc
source include/start_slave.inc;
disconnect slave;
--connection master_c
INSERT INTO t1 VALUES(6,'C',2);
......@@ -67,9 +66,7 @@ INSERT INTO t1 VALUES(6,'C',2);
INSERT INTO t1(b,c) VALUES('B',2);
# Wait while C will stop.
--connection master_c
--let $slave_param= Slave_SQL_Running
--let $slave_param_value= No
--source include/wait_for_slave_param.inc
source include/wait_for_slave_sql_to_stop.inc;
--connection master_a
INSERT INTO t1(b,c) VALUES('A',2);
--connection master_d
......@@ -105,8 +102,7 @@ STOP SLAVE;
--replace_result $SLAVE_MYPORT MASTER_B_PORT $file_c LOG_FILE $pos_c LOG_POS
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
START SLAVE;
--source include/wait_for_slave_to_start.inc
source include/start_slave.inc;
disconnect slave;
--connection master_b
--sync_slave_with_master master_d
......@@ -154,8 +150,7 @@ SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
# distributed to other servers
--echo * Remove wrong event from C and restore B->C->D *
--connection master_d
STOP SLAVE;
--wait_for_slave_to_stop
source include/stop_slave.inc;
--connection master_c
DELETE FROM t1 WHERE a = 6;
START SLAVE;
......
......@@ -12,7 +12,7 @@ source include/have_innodb.inc;
# set up "dual head"
let $keep_connection= 1;
let $slave_keep_connection= 1;
connection slave;
reset master;
......
......@@ -25,13 +25,8 @@ stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
start slave;
#
# Wait for start of slave IO and SQL threads
#
let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%';
--source include/wait_slave_status.inc
source include/start_slave.inc;
#
# Flush logs of slave
......
......@@ -207,9 +207,8 @@ select * from ti1 order by b /* must be (2),(3) */;
# foreign key: row is referenced
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
......@@ -240,11 +239,10 @@ delete from ti1 where b=3;
connection master;
insert into ti2 set a=3, b=3 /* offending write event */;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
--echo *** slave must stop
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
......@@ -282,9 +280,8 @@ connection master;
insert into ti1 set b=1 /* offending write event */;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
......@@ -318,9 +315,8 @@ connection master;
DELETE FROM t1 WHERE a = -2;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
......@@ -337,9 +333,8 @@ set global slave_exec_mode='STRICT';
connection master;
DELETE FROM t2 WHERE a = -2;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
......@@ -360,9 +355,8 @@ connection master;
UPDATE t1 SET a = 1 WHERE a = -1;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
......@@ -381,9 +375,8 @@ connection master;
UPDATE t2 SET a = 1 WHERE a = -1;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
......
......@@ -14,7 +14,7 @@ REPLACE INTO t1 VALUES (4);
SELECT * FROM t1;
connection slave;
--wait_for_slave_to_stop
source include/wait_for_slave_sql_to_stop.inc;
# The 4 should not be inserted into the table, since the incident log
# event should have stop the slave.
......
......@@ -7,33 +7,25 @@ source include/master-slave.inc;
set global max_connections=151;
connection slave;
stop slave;
source include/wait_for_slave_to_stop.inc;
start slave;
source include/wait_for_slave_to_start.inc;
source include/stop_slave.inc;
source include/start_slave.inc;
connection master;
save_master_pos;
connection slave;
sync_slave_with_master;
show variables like 'init_slave';
show variables like 'max_connections';
sync_with_master;
reset master;
connection master;
show variables like 'init_slave';
show variables like 'max_connections';
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
# Save variable value
set @my_global_init_connect= @@global.init_connect;
set global init_connect="set @c=1";
show variables like 'init_connect';
connection master;
save_master_pos;
connection slave;
sync_with_master;
stop slave;
sync_slave_with_master;
source include/stop_slave.inc;
# Restore changed global variable
set global init_connect= @my_global_init_connect;
......
......@@ -13,20 +13,14 @@
source include/master-slave.inc;
source include/show_master_status.inc;
sync_slave_with_master;
stop slave;
--source include/wait_for_slave_to_stop.inc
source include/stop_slave.inc;
change master to master_log_pos=75;
source include/show_slave_status2.inc;
start slave;
let $slave_param= Slave_SQL_Running;
let $slave_param_value= Yes;
--source include/wait_for_slave_param.inc
let $slave_param= Slave_IO_Running;
let $slave_param_value= No;
--source include/wait_for_slave_param.inc
stop slave;
--source include/wait_for_slave_to_stop.inc
source include/wait_for_slave_sql_to_start.inc;
source include/wait_for_slave_io_to_stop.inc;
source include/stop_slave.inc;
source include/show_slave_status.inc;
connection master;
......
......@@ -18,10 +18,8 @@ SET @@global.net_buffer_length=1024;
# Restart slave for setting to take effect
connection slave;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/stop_slave.inc;
source include/start_slave.inc;
# Reconnect to master for new setting to take effect
disconnect master;
......@@ -65,10 +63,8 @@ SET @@global.net_buffer_length=4096;
# Restart slave for new setting to take effect
connection slave;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/stop_slave.inc;
source include/start_slave.inc;
# Reconnect to master for new setting to take effect
disconnect master;
......
......@@ -35,8 +35,7 @@ let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
--echo Last_SQL_Error = $err
--echo ==== Clean up ====
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
--echo [on master]
connection master;
......
......@@ -15,12 +15,12 @@ save_master_pos;
connection slave;
# slave will automatically tell itself to stop thanks to the .opt
# slave will automatically stop the sql thread thanks to the .opt
# file; it will initiate the stop request after the first
# Rows_log_event (out of 3) but should wait until the last one is
# executed before stopping.
wait_for_slave_to_stop;
source include/wait_for_slave_sql_to_stop.inc;
# check that we inserted all rows (waited until the last Rows event)
select count(*) from t1;
......@@ -28,4 +28,5 @@ select count(*) from t1;
connection master;
drop table t1;
connection slave; # slave SQL thread is stopped
source include/stop_slave.inc;
drop table t1;
......@@ -9,12 +9,8 @@ let $VERSION=`select version()`;
# stop slave before he will start replication also sync with master
# for avoiding undetermenistic behaviour
save_master_pos;
connection slave;
sync_with_master;
stop slave;
# Make sure the slave sql and io thread has stopped
--source include/wait_for_slave_to_stop.inc
sync_slave_with_master;
--source include/stop_slave.inc
connection master;
# create some events on master
......@@ -53,9 +49,7 @@ connection master;
save_master_pos;
connection slave;
sync_with_master;
stop slave;
# Make sure the slave sql and io thread has stopped
--source include/wait_for_slave_to_stop.inc
--source include/stop_slave.inc
# this should stop immediately as we are already there
start slave sql_thread until master_log_file='master-bin.000001', master_log_pos=740;
......
......@@ -9,8 +9,7 @@ connection slave;
reset master;
# replicate ourselves
stop slave;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
start slave;
......
......@@ -77,11 +77,9 @@ if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) {
SELECT * FROM t2 ORDER BY a;
}
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
--source include/stop_slave.inc
RENAME TABLE t3_bak TO t3;
START SLAVE;
--source include/wait_for_slave_to_start.inc
--source include/start_slave.inc
--connection master
TRUNCATE t1;
......@@ -121,11 +119,9 @@ SHOW TABLES LIKE 't%';
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
--source include/stop_slave.inc
RENAME TABLE t3_bak TO t3;
START SLAVE;
--source include/wait_for_slave_to_start.inc
--source include/start_slave.inc
--connection master
TRUNCATE t1;
......@@ -167,11 +163,9 @@ SHOW TABLES LIKE 't%';
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
source include/stop_slave.inc;
RENAME TABLE t3_bak TO t3;
START SLAVE;
--source include/wait_for_slave_to_start.inc
source include/start_slave.inc;
# Clean up
--echo *** Clean up ***
......
......@@ -110,8 +110,7 @@ DELIMITER ;|
--echo **** On Slave ****
sync_slave_with_master;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
--echo **** On Master ****
connection master;
......@@ -131,8 +130,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/start_slave.inc;
sync_with_master;
SELECT * FROM t1 ORDER BY a;
......@@ -156,8 +154,7 @@ CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb;
--echo **** On Slave ****
sync_slave_with_master;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
--echo *** On Master ***
connection master;
......@@ -182,8 +179,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/start_slave.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
......@@ -194,8 +190,7 @@ SELECT * FROM t6 ORDER BY a;
--echo **** On Slave ****
connection slave;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
--echo *** On Master ***
connection master;
......@@ -220,8 +215,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/start_slave.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
......@@ -232,8 +226,7 @@ SELECT * FROM t6 ORDER BY a;
# And the same, but with autocommit = 0
#
connection slave;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
connection master;
SET AUTOCOMMIT=0;
......@@ -257,8 +250,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/start_slave.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
......@@ -280,8 +272,7 @@ CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam;
--echo *** On Slave ***
sync_slave_with_master;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
--echo *** On Master ***
connection master;
......@@ -297,8 +288,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/start_slave.inc;
sync_with_master;
SELECT * FROM t10 ORDER BY a;
......
......@@ -27,11 +27,9 @@ GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
--echo [on slave]
sync_slave_with_master;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
CHANGE MASTER TO master_user='rpl', master_password='rpl';
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/start_slave.inc;
--echo ==== Do replication as new user ====
--echo [on master]
......@@ -53,8 +51,7 @@ sync_slave_with_master;
--echo ==== Restart slave without privileges =====
# (slave.err will contain access denied error for this START SLAVE command)
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
source include/stop_slave.inc;
START SLAVE;
source include/wait_for_slave_sql_to_start.inc;
......
......@@ -11,6 +11,7 @@
source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
# we need a db != test, where we don't have automatic grants
--disable_warnings
drop database if exists mysqltest1;
......@@ -240,6 +241,8 @@ begin
end|
delimiter ;|
connection master;
set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
# test old variable name:
set global log_bin_trust_routine_creators=1;
# now use new name:
......@@ -247,6 +250,8 @@ set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
# slave needs it too otherwise will not execute what master allowed:
connection slave;
set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=1;
connection con1;
......@@ -571,9 +576,12 @@ show binlog events in 'master-bin.000001' from 106;
# Restore log_bin_trust_function_creators to its original value.
# This is a cleanup for all parts above where we tested stored
# functions and triggers.
set global log_bin_trust_function_creators=0;
connection slave;
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
connection master;
set global log_bin_trust_function_creators=0;
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
# Clean up
drop database mysqltest;
......
......@@ -10,6 +10,8 @@
# ****************************************************************
connection master;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
# cleanup
--disable_warnings
drop procedure if exists p1;
......@@ -254,8 +256,8 @@ drop table t2;
drop procedure sp_bug26199;
drop function sf_bug26199;
sync_slave_with_master;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 0;
sync_slave_with_master;
--echo end of the tests
......@@ -8,12 +8,8 @@ let $VERSION=`select version()`;
# stop slave before he will start replication also sync with master
# for avoiding undetermenistic behaviour
save_master_pos;
connection slave;
sync_with_master;
stop slave;
# Make sure the slave sql and io thread has stopped
--source include/wait_for_slave_to_stop.inc
sync_slave_with_master;
--source include/stop_slave.inc
connection master;
# create some events on master
......@@ -49,12 +45,8 @@ source include/show_slave_status2.inc;
# clean up
start slave;
connection master;
save_master_pos;
connection slave;
sync_with_master;
stop slave;
# Make sure the slave sql and io thread has stopped
--source include/wait_for_slave_to_stop.inc
sync_slave_with_master;
--source include/stop_slave.inc
# this should stop immediately as we are already there
start slave until master_log_file='master-bin.000001', master_log_pos=776;
......
......@@ -180,7 +180,7 @@ Last_IO_Error <Last_IO_Error>
Last_SQL_Errno <Last_SQL_Errno>
Last_SQL_Error <Last_SQL_Error>
set GLOBAL slave_transaction_retries=10;
START SLAVE;
include/start_slave.inc
select * from t1 order by nid;
nid nom prenom
1 LOCK ABC1
......
......@@ -423,10 +423,10 @@ a b c
**** On Master ****
DELETE FROM t1;
**** Resetting master and slave ****
STOP SLAVE;
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
START SLAVE;
include/start_slave.inc
**** On Master ****
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
**** On Master ****
......
......@@ -184,22 +184,21 @@ set GLOBAL slave_transaction_retries=1;
--echo **** On Master ****
UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
--echo **** On Slave ****
# Wait for deadlock to be detected.
# When detected, the slave will stop, so we just wait for it to stop.
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
# Replication should have stopped, since max retries were not enough.
# verify with show slave status
--connection slave
--echo **** On Slave ****
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS;
# now set max retries high enough to succeed, and start slave again
set GLOBAL slave_transaction_retries=10;
START SLAVE;
source include/wait_for_slave_to_start.inc;
source include/start_slave.inc;
# Wait for deadlock to be detected and retried.
# We want to wait until at least one retry has been made, but before
# the slave stops. currently, there is no safe way to do that: we
......
......@@ -106,3 +106,4 @@ rpl_max_binlog_size_func : BUG#37962 2008-07-08 sven *_func tests c
slow_query_log_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
sql_low_priority_updates_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
timestamp_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
log_output_func : BUG#37766 2008-07-10 sven main.log_output_func randomly fails in pushbuild
......@@ -606,6 +606,7 @@ select time_format('100:00:00', '%H %k %h %I %l');
# Bug #12562: Make SYSDATE behave like it does in Oracle: always the current
# time, regardless of magic to make NOW() always the same for the
# entirety of a statement.
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (a timestamp default '2005-05-05 01:01:01',
......@@ -656,6 +657,7 @@ end;
delimiter ;//
call t_sysdate();
drop procedure t_sysdate;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
#
# Bug #13534: timestampdiff() returned incorrect results across leap years
......
......@@ -3,6 +3,7 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
# Cleanup
......@@ -1468,4 +1469,4 @@ use test;
DROP DATABASE dbbug33464;
--echo End of 5.1 tests
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
......@@ -488,6 +488,7 @@ flush privileges;
# BUG#13310 incorrect user parsing by SP
#
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
grant all privileges on test.* to `a@`@localhost;
......@@ -512,7 +513,7 @@ connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
#
......
......@@ -5,6 +5,8 @@
drop table if exists t1;
--enable_warnings
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
connect (a,localhost,root,,);
connect (b,localhost,root,,);
......@@ -39,4 +41,4 @@ drop table t1;
drop function f1;
disconnect a;
disconnect b;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
......@@ -35,6 +35,7 @@ drop table if exists t1;
CREATE user tt@localhost;
--echo ## Setting value of variable to 0 ##
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET @@global.log_bin_trust_function_creators = 0;
--echo ## Creating new table t2 ##
......@@ -119,3 +120,7 @@ drop table t1,t2;
--echo ## Disconnecting both the connections ##
disconnect test_con2;
connection default;
DROP USER tt@localhost;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
......@@ -801,9 +801,10 @@ create procedure `p1`()
begin
select a, f1() from t1;
end//
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
call p1()//
SET GLOBAL log_bin_trust_function_creators = 0;
SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
drop procedure p1//
drop function f1//
......
......@@ -183,6 +183,8 @@ drop table t1;
#
# bug#14767: INSERT in SF + concurrent SELECT with query cache
#
connection default;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
reset query cache;
......@@ -224,7 +226,7 @@ disconnect con2;
connection default;
set GLOBAL query_cache_size=0;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
#
# Bug #30269 Query cache eats memory
......
......@@ -73,8 +73,7 @@ sync_with_master;
SET @@global.init_slave = "SET @a=5";
stop slave;
--wait_for_slave_to_stop
source include/stop_slave.inc;
reset slave;
# Clean up old test tables
--disable_warnings
......
......@@ -228,6 +228,7 @@ drop table t1;
# Test for bug #11081 "Using a CONVERT_TZ function in a stored function
# or trigger fails".
#
SET @old_log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (ldt datetime, udt datetime);
......@@ -243,7 +244,7 @@ select ldt, f1(udt) as ldt2 from t1;
drop table t1;
drop function f1;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
# End of 5.0 tests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment