MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
binlog_stmt_cache_size_basic.inc
1 ################ mysql-test\t\binlog_stmt_cache_size_basic.test ################
2 # #
3 # Variable Name: binlog_stmt_cache_size #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: Numeric #
7 # Default Value: 32768 #
8 # Range: 4096 - 4294967295 #
9 # #
10 # #
11 # Creation Date: 2010-10-12 #
12 # Author: Alfranio Correia #
13 # #
14 # Description: Test Cases of Dynamic System Variable "binlog_stmt_cache_size" #
15 # that checks behavior of this variable in the following ways #
16 # * Default Value #
17 # * Valid & Invalid values #
18 # * Scope & Access method #
19 # * Data Integrity . #
20 # #
21 # Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
22 # server-system-variables.html#option_mysqld_binlog_stmt_cache_size #
23 # #
24 ################################################################################
25 
26 #################################################################
27 # START OF binlog_stmt_cache_size TESTS #
28 #################################################################
29 
30 #########################################################################
31 # Saving initial value of binlog_stmt_cache_size in a temporary variable #
32 #########################################################################
33 
34 SET @start_value = @@global.binlog_stmt_cache_size;
35 SELECT @start_value;
36 
37 --echo '#--------------------FN_DYNVARS_006_01------------------------#'
38 #########################################################################
39 # Display the DEFAULT value of binlog_stmt_cache_size #
40 #########################################################################
41 
42 SET @@global.binlog_stmt_cache_size = 100;
43 SET @@global.binlog_stmt_cache_size = DEFAULT;
44 SELECT @@global.binlog_stmt_cache_size;
45 
46 
47 --echo '#---------------------FN_DYNVARS_006_02-------------------------#'
48 ###############################################
49 # Verify default value of variable #
50 ###############################################
51 
52 SET @@global.binlog_stmt_cache_size = @start_value;
53 SELECT @@global.binlog_stmt_cache_size = 32768;
54 
55 
56 --echo '#--------------------FN_DYNVARS_006_03------------------------#'
57 #########################################################################
58 # Change the value of binlog_stmt_cache_size to a valid value #
59 #########################################################################
60 
61 SET @@global.binlog_stmt_cache_size = 4096;
62 SELECT @@global.binlog_stmt_cache_size;
63 SET @@global.binlog_stmt_cache_size = 4294967295;
64 SELECT @@global.binlog_stmt_cache_size;
65 SET @@global.binlog_stmt_cache_size = 10000;
66 SELECT @@global.binlog_stmt_cache_size;
67 SET @@global.binlog_stmt_cache_size = 21221204;
68 SELECT @@global.binlog_stmt_cache_size;
69 echo 'Bug: Invalid values are coming in variable on assigning valid values';
70 
71 
72 --echo '#--------------------FN_DYNVARS_006_04-------------------------#'
73 ############################################################################
74 # Change the value of binlog_stmt_cache_size to invalid value #
75 ############################################################################
76 
77 SET @@global.binlog_stmt_cache_size = 1024;
78 SELECT @@global.binlog_stmt_cache_size;
79 --Error ER_WRONG_TYPE_FOR_VAR
80 SET @@global.binlog_stmt_cache_size = 10000.01;
81 SET @@global.binlog_stmt_cache_size = -1024;
82 SELECT @@global.binlog_stmt_cache_size;
83 SET @@global.binlog_stmt_cache_size = 42949672950;
84 SELECT @@global.binlog_stmt_cache_size;
85 echo 'Bug: Errors are not coming on assigning invalid values to variable';
86 
87 --Error ER_WRONG_TYPE_FOR_VAR
88 SET @@global.binlog_stmt_cache_size = ON;
89 
90 --Error ER_WRONG_TYPE_FOR_VAR
91 SET @@global.binlog_stmt_cache_size = 'test';
92 
93 
94 --echo '#-------------------FN_DYNVARS_006_05----------------------------#'
95 ############################################################################
96 # Test if accessing session binlog_stmt_cache_size gives error #
97 ############################################################################
98 
99 --Error ER_GLOBAL_VARIABLE
100 SET @@session.binlog_stmt_cache_size = 0;
101 
102 
103 --echo '#----------------------FN_DYNVARS_006_06------------------------#'
104 ##############################################################################
105 # Check if the value in GLOBAL Tables matches values in variable #
106 ##############################################################################
107 
108 SELECT @@global.binlog_stmt_cache_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_stmt_cache_size';
109 
110 --echo '#---------------------FN_DYNVARS_006_07----------------------#'
111 ###################################################################
112 # Check if TRUE and FALSE values can be used on variable #
113 ###################################################################
114 
115 SET @@global.binlog_stmt_cache_size = TRUE;
116 SELECT @@global.binlog_stmt_cache_size;
117 SET @@global.binlog_stmt_cache_size = FALSE;
118 SELECT @@global.binlog_stmt_cache_size;
119 echo 'Bug: Errors are not coming on assigning TRUE/FALSE to variable';
120 
121 --echo '#---------------------FN_DYNVARS_006_08----------------------#'
122 ###############################################################################
123 # Check if accessing variable without SCOPE points to same global variable #
124 ###############################################################################
125 
126 SET @@global.binlog_stmt_cache_size = 1;
127 SELECT @@binlog_stmt_cache_size = @@global.binlog_stmt_cache_size;
128 
129 --echo '#---------------------FN_DYNVARS_006_09----------------------#'
130 ###########################################################################
131 # Check if binlog_stmt_cache_size can be accessed with and without @@ sign#
132 ###########################################################################
133 
134 --Error ER_GLOBAL_VARIABLE
135 SET binlog_stmt_cache_size = 1;
136 --Error ER_PARSE_ERROR
137 SET global.binlog_stmt_cache_size = 1;
138 --Error ER_UNKNOWN_TABLE
139 SELECT global.binlog_stmt_cache_size;
140 --Error ER_BAD_FIELD_ERROR
141 SELECT binlog_stmt_cache_size = @@session.binlog_stmt_cache_size;
142 
143 
144 ##############################
145 # Restore initial value #
146 ##############################
147 
148 SET @@global.binlog_stmt_cache_size = @start_value;
149 SELECT @@global.binlog_stmt_cache_size;
150 
151 
152 ###########################################################
153 # END OF binlog_stmt_cache_size TESTS #
154 ###########################################################