Debian Codegraph @

mysql-test/suite/sys_vars/t/pseudo_replica_mode_basic.test

raw
1 ####################### mysql-test\t\pseudo_replica_mode_basic.test ###################
2 # #
3 # Variable Name: pseudo_replica_mode #
4 # Scope: SESSION #
5 # Access Type: Dynamic #
6 # Data Type: boolean #
7 # Default Value: #
8 # Valid Values: 0,1 #
9 # #
10 # #
11 # Creation Date: 2012-11-16 #
12 # #
13 # Description: Test Cases of Dynamic System Variable pseudo_replica_mode #
14 # that checks the behavior of this variable in the following ways#
15 # * Default Value #
16 # * Valid & Invalid values #
17 # * Scope & Access method #
18 # * Data Integrity #
19 # #
20 # Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
21 # server-system-variables.html #
22 # #
23 ###############################################################################
24
25 # Test semantics require --xa_detach_on_prepare
26 --let $option_name = xa_detach_on_prepare
27 --let $option_value = 1
28 --source include/only_with_option.inc
29
30 --source include/load_sysvars.inc
31
32 ########################################################################
33 # START OF pseudo_replica_mode TESTS #
34 ########################################################################
35
36
37 ##############################################################################
38 # Saving initial value of pseudo_replica_mode in a temporary variable #
39 ##############################################################################
40
41 SET @session_start_value = @@session.pseudo_replica_mode;
42 SELECT @session_start_value;
43
44 --echo '#--------------------FN_DYNVARS_156_01------------------------#'
45 ########################################################################
46 # Display the DEFAULT value of pseudo_replica_mode #
47 ########################################################################
48
49 SET @@session.pseudo_replica_mode = 0;
50 SET @@session.pseudo_replica_mode = DEFAULT;
51 SELECT @@session.pseudo_replica_mode;
52
53 SET @@session.pseudo_replica_mode = 1;
54 SET @@session.pseudo_replica_mode = DEFAULT;
55 SELECT @@session.pseudo_replica_mode;
56
57 SET @@session.pseudo_replica_mode = 1;
58 SET @@session.pseudo_slave_mode = DEFAULT;
59 SELECT @@session.pseudo_replica_mode;
60
61
62 --echo '#---------------------FN_DYNVARS_156_02-------------------------#'
63 #############################################################################
64 # Check if pseudo_replica_mode can be accessed with and without @@ sign #
65 #############################################################################
66
67 SET pseudo_replica_mode = 1;
68 SELECT @@pseudo_replica_mode;
69
70 --Error ER_UNKNOWN_TABLE
71 SELECT session.pseudo_replica_mode;
72
73 --Error ER_UNKNOWN_TABLE
74 SELECT local.pseudo_replica_mode;
75
76 SET session pseudo_replica_mode = 0;
77 SELECT @@session.pseudo_replica_mode;
78
79
80 --echo '#--------------------FN_DYNVARS_156_03------------------------#'
81 ########################################################################
82 # change the value of pseudo_replica_mode to a valid value #
83 ########################################################################
84
85 SET @@session.pseudo_replica_mode = 0;
86 SELECT @@session.pseudo_replica_mode;
87 SET @@session.pseudo_replica_mode = 1;
88 SELECT @@session.pseudo_replica_mode;
89
90
91 --echo '#--------------------FN_DYNVARS_156_04-------------------------#'
92 ###########################################################################
93 # Change the value of pseudo_replica_mode to invalid value #
94 ###########################################################################
95
96 --Error ER_WRONG_VALUE_FOR_VAR
97 SET @@session.pseudo_replica_mode = -1;
98 --Error ER_WRONG_VALUE_FOR_VAR
99 SET @@session.pseudo_replica_mode = 2;
100 --Error ER_WRONG_VALUE_FOR_VAR
101 SET @@session.pseudo_replica_mode = "T";
102 --Error ER_WRONG_VALUE_FOR_VAR
103 SET @@session.pseudo_replica_mode = "Y";
104 --Error ER_WRONG_VALUE_FOR_VAR
105 SET @@session.pseudo_replica_mode = TRÜE;
106 --Error ER_WRONG_VALUE_FOR_VAR
107 SET @@session.pseudo_replica_mode = ÕN;
108 --error ER_PARSE_ERROR
109 SET @@session.pseudo_replica_mode = OF;
110 --Error ER_WRONG_VALUE_FOR_VAR
111 SET @@session.pseudo_replica_mode = ÓFF;
112 --Error ER_WRONG_VALUE_FOR_VAR
113 SET @@session.pseudo_replica_mode = '¹';
114 --Error ER_WRONG_VALUE_FOR_VAR
115 SET @@session.pseudo_replica_mode = NO;
116
117
118 --echo '#-------------------FN_DYNVARS_156_05----------------------------#'
119 ###########################################################################
120 # Test if accessing global pseudo_replica_mode gives error #
121 ###########################################################################
122
123 --error ER_LOCAL_VARIABLE
124 SET @@global.pseudo_replica_mode = 0;
125 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
126 SELECT @@global.pseudo_replica_mode;
127
128 --echo '#----------------------FN_DYNVARS_156_06------------------------#'
129 #########################################################################
130 # Check if the value in SESSION Table contains variable value #
131 #########################################################################
132
133 --disable_warnings
134 SELECT count(VARIABLE_VALUE) FROM performance_schema.session_variables WHERE VARIABLE_NAME='pseudo_replica_mode';
135 --enable_warnings
136
137 --echo '#----------------------FN_DYNVARS_156_07------------------------#'
138 #########################################################################
139 # Check if the value in SESSION Table matches value in variable #
140 #########################################################################
141
142 --disable_warnings
143 SELECT IF(@@session.pseudo_replica_mode, "ON", "OFF") = VARIABLE_VALUE
144 FROM performance_schema.session_variables
145 WHERE VARIABLE_NAME='pseudo_replica_mode';
146 --enable_warnings
147 SELECT @@session.pseudo_replica_mode;
148 --disable_warnings
149 SELECT VARIABLE_VALUE
150 FROM performance_schema.session_variables
151 WHERE VARIABLE_NAME='pseudo_replica_mode';
152 --enable_warnings
153
154 --echo '#---------------------FN_DYNVARS_156_08-------------------------#'
155 ###################################################################
156 # Check if ON and OFF values can be used on variable #
157 ###################################################################
158
159 SET @@session.pseudo_replica_mode = OFF;
160 SELECT @@session.pseudo_replica_mode;
161 SET @@session.pseudo_replica_mode = ON;
162 SELECT @@session.pseudo_replica_mode;
163
164 --echo '#---------------------FN_DYNVARS_156_09----------------------#'
165 ###################################################################
166 # Check if TRUE and FALSE values can be used on variable #
167 ###################################################################
168
169 SET @@session.pseudo_replica_mode = TRUE;
170 SELECT @@session.pseudo_replica_mode;
171 SET @@session.pseudo_replica_mode = FALSE;
172 SELECT @@session.pseudo_replica_mode;
173
174 --echo '#---------------------FN_DYNVARS_156_10----------------------#'
175 ######################################################################
176 # Check that pseudo_replica_mode cannot be changed inside transaction. #
177 ######################################################################
178 BEGIN;
179 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
180 SET @@session.pseudo_replica_mode = TRUE;
181 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
182 SET @@session.pseudo_replica_mode = FALSE;
183 COMMIT;
184
185 ######################################################################
186 # Check that pseudo_replica_mode cannot be changed when a XA #
187 # transaction is in active state. #
188 ######################################################################
189 XA START 'xa1';
190 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
191 SET @@session.pseudo_replica_mode = TRUE;
192 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
193 SET @@session.pseudo_replica_mode = FALSE;
194 XA END 'xa1';
195 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
196 SET @@session.pseudo_replica_mode = TRUE;
197 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
198 SET @@session.pseudo_replica_mode = FALSE;
199 XA PREPARE 'xa1';
200 SET @@session.pseudo_replica_mode = TRUE;
201 SET @@session.pseudo_replica_mode = FALSE;
202 XA COMMIT 'xa1';
203 SET @@session.pseudo_replica_mode = TRUE;
204 SET @@session.pseudo_replica_mode = FALSE;
205
206 ##############################
207 # Restore initial value #
208 ##############################
209
210 SET @@session.pseudo_replica_mode = @session_start_value;
211 SELECT @@session.pseudo_replica_mode;
212
213 ###############################################################
214 # END OF pseudo_replica_mode TESTS #
215 ###############################################################