1
###################### mysql-test\t\init_slave_func.test #####################
3
# Variable Name: init_slave #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-03-08 #
13
# Modified: HHunger 2008-09-29 Fixed the bug by inserting the usual wait and #
14
# SQL-Satements to control master and slave, #
15
# deleted the sleep and made improvements like: #
16
# - Replaced the opt file by dynamic variables, #
17
# - Made the tests independant of the initial #
18
# values of the global variables, #
19
# - Reduced the test to the needed test case to #
23
# Description: Test Cases of Dynamic System Variable init_slave #
24
# that checks the behavior of this variable #
27
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
29
###############################################################################
31
source include/master-slave.inc;
32
--echo connection slave
35
# save the current values
37
SET @start_max_connections= @@global.max_connections;
38
SET @start_init_slave= @@global.init_slave;
40
# setting of a global value with an effect on the next start of the slave server
41
# check that @@global.init_slave could be set
43
'SET @@global.max_connections = @@global.max_connections + 1';
44
eval SET @@global.init_slave = $my_init_slave;
46
# show the data type of the variable
48
DROP TABLE IF EXISTS t1;
49
CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
54
# check that the new setting of @@global.init_slave becomes immediately visible
55
eval SELECT @@global.init_slave = $my_init_slave;
57
# wait for the slave threads have set the global variable.
58
let $wait_timeout= 90;
59
let $wait_condition= SELECT @@global.max_connections = @start_max_connections;
60
--source include/wait_condition_sp.inc
61
# check that the action in init_slave does not happen immediately
62
SELECT @@global.max_connections= @start_max_connections;
67
--wait_for_slave_to_stop
71
source include/wait_for_slave_to_start.inc;
73
# wait for the slave threads have set the global variable.
74
let $wait_timeout= 90;
75
let $wait_condition= SELECT @@global.max_connections = @start_max_connections + 1;
76
--source include/wait_condition_sp.inc
77
# check that the action in init_slave was executed and had the intended effect
78
SELECT @@global.max_connections = @start_max_connections + 1;
81
# Setting a variable(which is local to a session) and must not be visible
82
SET @@global.init_slave = "SET @a=5";
85
--wait_for_slave_to_stop
89
source include/wait_for_slave_to_start.inc;
91
SHOW VARIABLES LIKE 'init_slave';
97
SET @@global.max_connections= @start_max_connections;
98
SET @@global.init_slave= @start_init_slave;
99
##################################################
100
# End of functionality Testing for init_slave #
101
##################################################