~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/include/query_cache_size_basic.inc

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
############## mysql-test\t\query_cache_size_basic.test ###############
 
2
#                                                                             #
 
3
# Variable Name: query_cache_size                                             #
 
4
# Scope: GLOBAL                                                               #
 
5
# Access Type: Dynamic                                                        #
 
6
# Data Type: numeric                                                          #
 
7
# Default Value:  0                                                           #
 
8
# Range:     -                                                                #
 
9
#                                                                             #
 
10
#                                                                             #
 
11
# Creation Date: 2008-02-07                                                   #
 
12
# Author:  Salman                                                             #
 
13
#                                                                             #
 
14
# Description: Test Cases of Dynamic System Variable query_cache_size         #
 
15
#              that checks the 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.1/en/                          #
 
22
#  server-system-variables.html                                               #
 
23
#                                                                             #
 
24
###############################################################################
 
25
 
 
26
--source include/have_query_cache.inc
 
27
--source include/load_sysvars.inc
 
28
 
 
29
######################################################################## 
 
30
#             START OF query_cache_size TESTS                  #
 
31
######################################################################## 
 
32
 
 
33
 
 
34
############################################################################### 
 
35
# Saving initial value of query_cache_size in a temporary variable    #
 
36
############################################################################### 
 
37
 
 
38
SET @start_value = @@global.query_cache_size;
 
39
SELECT @start_value;
 
40
 
 
41
--echo '#--------------------FN_DYNVARS_133_01------------------------#'
 
42
############################################################################### 
 
43
#              Display the DEFAULT value of query_cache_size          #
 
44
############################################################################### 
 
45
 
 
46
SET @@global.query_cache_size = 99;
 
47
SET @@global.query_cache_size = DEFAULT;
 
48
SELECT @@global.query_cache_size;
 
49
 
 
50
--echo '#---------------------FN_DYNVARS_133_02-------------------------#'
 
51
############################################### 
 
52
#     Verify default value of variable        #
 
53
############################################### 
 
54
 
 
55
SET @@global.query_cache_size = @start_value;
 
56
SELECT @@global.query_cache_size = 0;
 
57
 
 
58
--echo '#--------------------FN_DYNVARS_133_03------------------------#'
 
59
################################################################################ 
 
60
#        Change the value of query_cache_size to a valid value         #
 
61
################################################################################ 
 
62
 
 
63
SET @@global.query_cache_size = 0;
 
64
SELECT @@global.query_cache_size;
 
65
SET @@global.query_cache_size = 1;
 
66
SELECT @@global.query_cache_size;
 
67
 
 
68
SET @@global.query_cache_size = 512;
 
69
SELECT @@global.query_cache_size;
 
70
SET @@global.query_cache_size = 1024;
 
71
SELECT @@global.query_cache_size;
 
72
--echo : 'Bug#34880: Warnings are coming on assinging valid values to variable
 
73
--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
 
74
SET @@global.query_cache_size = 1048576;
 
75
SELECT @@global.query_cache_size;
 
76
SET @@global.query_cache_size = 1048575;
 
77
SELECT @@global.query_cache_size;
 
78
 
 
79
--echo '#--------------------FN_DYNVARS_133_04-------------------------#'
 
80
################################################################################### 
 
81
#         Change the value of query_cache_size to invalid value           #
 
82
################################################################################### 
 
83
 
 
84
SET @@global.query_cache_size = -1;
 
85
SELECT @@global.query_cache_size;
 
86
SET @@global.query_cache_size = 4294967296;
 
87
SELECT @@global.query_cache_size;
 
88
SET @@global.query_cache_size = 511;
 
89
SELECT @@global.query_cache_size;
 
90
--Error ER_WRONG_TYPE_FOR_VAR
 
91
SET @@global.query_cache_size = 10000.01;
 
92
SELECT @@global.query_cache_size;
 
93
SET @@global.query_cache_size = -1024;
 
94
SELECT @@global.query_cache_size;
 
95
SET @@global.query_cache_size = 42949672950;
 
96
SELECT @@global.query_cache_size;
 
97
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
 
98
 
 
99
--Error ER_WRONG_TYPE_FOR_VAR
 
100
SET @@global.query_cache_size = ON;
 
101
SELECT @@global.query_cache_size;
 
102
--Error ER_WRONG_TYPE_FOR_VAR
 
103
SET @@global.query_cache_size = 'test';
 
104
SELECT @@global.query_cache_size;
 
105
 
 
106
--echo '#-------------------FN_DYNVARS_133_05----------------------------#'
 
107
################################################################################### 
 
108
#       Test if accessing session query_cache_size gives error            #
 
109
################################################################################### 
 
110
 
 
111
--Error ER_GLOBAL_VARIABLE
 
112
SET @@session.query_cache_size = 0;
 
113
SELECT @@query_cache_size;
 
114
 
 
115
--echo '#----------------------FN_DYNVARS_133_06------------------------#'
 
116
############################################################################## 
 
117
# Check if the value in GLOBAL & SESSION Tables matches values in variable   #
 
118
##############################################################################
 
119
 
 
120
SELECT @@global.query_cache_size = VARIABLE_VALUE 
 
121
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 
122
WHERE VARIABLE_NAME='query_cache_size';
 
123
 
 
124
SELECT @@query_cache_size = VARIABLE_VALUE 
 
125
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
 
126
WHERE VARIABLE_NAME='query_cache_size';
 
127
 
 
128
--echo '#---------------------FN_DYNVARS_133_07----------------------#'
 
129
################################################################### 
 
130
#      Check if TRUE and FALSE values can be used on variable     #
 
131
################################################################### 
 
132
 
 
133
SET @@global.query_cache_size = TRUE;
 
134
SELECT @@global.query_cache_size;
 
135
SET @@global.query_cache_size = FALSE;
 
136
SELECT @@global.query_cache_size;
 
137
 
 
138
--echo '#---------------------FN_DYNVARS_133_08----------------------#'
 
139
########################################################################################################
 
140
#    Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable  #
 
141
########################################################################################################
 
142
 
 
143
SET @@global.query_cache_size = 1;
 
144
SELECT @@query_cache_size = @@global.query_cache_size;
 
145
 
 
146
--echo '#---------------------FN_DYNVARS_133_09----------------------#'
 
147
##################################################################################  
 
148
#   Check if query_cache_size can be accessed with and without @@ sign   #
 
149
##################################################################################
 
150
 
 
151
--Error ER_GLOBAL_VARIABLE
 
152
SET query_cache_size = 1;
 
153
SELECT @@query_cache_size;
 
154
--Error ER_PARSE_ERROR
 
155
SET local.query_cache_size = 1;
 
156
--Error ER_UNKNOWN_TABLE
 
157
SELECT local.query_cache_size;
 
158
--Error ER_PARSE_ERROR
 
159
SET global.query_cache_size = 1;
 
160
--Error ER_UNKNOWN_TABLE
 
161
SELECT global.query_cache_size;
 
162
--Error ER_BAD_FIELD_ERROR
 
163
SELECT query_cache_size = @@session.query_cache_size;
 
164
 
 
165
##############################  
 
166
#   Restore initial value    #
 
167
##############################
 
168
 
 
169
SET @@global.query_cache_size = @start_value;
 
170
SELECT @@global.query_cache_size;
 
171
 
 
172
######################################################################## 
 
173
#              END OF query_cache_size TESTS                   #
 
174
######################################################################## 
 
175