1
###############################################################################
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
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
38
# save the current values
40
SET @start_max_connections= @@global.max_connections;
41
SET @start_init_slave= @@global.init_slave;
43
# setting of a global value with an effect on the next start of the slave server
44
# check that @@global.init_slave could be set
47
'SET @@global.max_connections = @@global.max_connections + 1 -- комментарий';
48
eval SET @@global.init_slave = $my_init_slave;
50
# show the data type of the variable
52
DROP TABLE IF EXISTS t1;
53
CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
56
select length(my_column) from t1;
59
# check that the new setting of @@global.init_slave becomes immediately visible
60
eval SELECT @@global.init_slave = $my_init_slave;
62
# wait for the slave threads have set the global variable.
63
let $wait_timeout= 90;
64
let $wait_condition= SELECT @@global.max_connections = @start_max_connections;
65
--source include/wait_condition_sp.inc
66
# check that the action in init_slave does not happen immediately
67
--let $assert_text= @@global.max_connections = @start_max_connections
68
--let $assert_cond= @@global.max_connections = @start_max_connections
69
--source include/assert.inc
73
--wait_for_slave_to_stop
77
source include/wait_for_slave_to_start.inc;
79
# wait for the slave threads have set the global variable.
80
let $wait_timeout= 90;
81
let $wait_condition= SELECT @@global.max_connections = @start_max_connections + 1;
82
--source include/wait_condition_sp.inc
83
# check that the action in init_slave was executed and had the intended effect
84
--let $assert_text= @@global.max_connections = @start_max_connections + 1
85
--let $assert_cond= @@global.max_connections = @start_max_connections + 1
86
--source include/assert.inc
88
# Setting a variable(which is local to a session) and must not be visible
89
SET @@global.init_slave = "SET @a=5";
92
--wait_for_slave_to_stop
96
source include/wait_for_slave_to_start.inc;
98
SHOW VARIABLES LIKE 'init_slave';
104
SET @@global.max_connections= @start_max_connections;
105
SET @@global.init_slave= @start_init_slave;
106
##################################################
107
# End of functionality Testing for init_slave #
108
##################################################
110
--source include/rpl_end.inc