1
############## mysql-test\t\table_open_cache_basic.test #######################
3
# Variable Name: table_open_cache #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-13 #
14
# Description: Test Cases of Dynamic System Variable table_open_cache #
15
# that checks the behavior of this variable in the following ways#
17
# * Valid & Invalid values #
18
# * Scope & Access method #
21
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22
# server-system-variables.html#option_mysqld_table_open_cache #
24
###############################################################################
26
--source include/load_sysvars.inc
28
########################################################################
29
# START OF table_open_cache TESTS #
30
########################################################################
33
##########################################################################
34
# Saving initial value of table_open_cache in a temporary variable #
35
##########################################################################
37
SET @start_value = @@global.table_open_cache ;
41
--echo '#--------------------FN_DYNVARS_001_01------------------------#'
42
########################################################################
43
# Display the DEFAULT value of table_open_cache #
44
########################################################################
46
SET @@global.table_open_cache = 99;
47
SET @@global.table_open_cache = DeFAULT;
48
SELECT @@global.table_open_cache;
51
--echo '#---------------------FN_DYNVARS_001_02-------------------------#'
52
###############################################
53
# Verify default value of variable #
54
###############################################
56
SET @@global.table_open_cache = Default;
57
SELECT @@global.table_open_cache = 64;
59
--echo '#--------------------FN_DYNVARS_001_03------------------------#'
60
########################################################################
61
# Change the value of table_open_cache to a valid value #
62
########################################################################
65
SET @@global.table_open_cache = 8;
66
SELECT @@global.table_open_cache ;
68
SET @@global.table_open_cache = 1;
69
SELECT @@global.table_open_cache ;
71
SET @@global.table_open_cache = 1073741824;
72
SELECT @@global.table_open_cache ;
74
SET @@global.table_open_cache = 18000;
75
SELECT @@global.table_open_cache ;
76
SET @@global.table_open_cache = 65535;
77
SELECT @@global.table_open_cache ;
81
--echo '#--------------------FN_DYNVARS_001_04-------------------------#'
82
#######################################################################
83
# Change the value of table_open_cache to invalid value #
84
#######################################################################
86
SET @@global.table_open_cache = -1;
87
SELECT @@global.table_open_cache ;
89
SET @@global.table_open_cache = 100000000000;
90
SELECT @@global.table_open_cache ;
92
SET @@global.table_open_cache = -1024;
93
SELECT @@global.table_open_cache ;
95
SET @@global.table_open_cache = 0;
96
SELECT @@global.table_open_cache ;
98
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
101
--Error ER_WRONG_TYPE_FOR_VAR
102
SET @@global.table_open_cache = 10000.01;
104
--Error ER_WRONG_TYPE_FOR_VAR
105
SET @@global.table_open_cache = ON;
106
--Error ER_WRONG_TYPE_FOR_VAR
107
SET @@global.table_open_cache= 'test';
109
--Error ER_WRONG_TYPE_FOR_VAR
110
SET @@global.table_open_cache = '';
113
--echo '#-------------------FN_DYNVARS_001_05----------------------------#'
114
###########################################################################
115
# Test if accessing session table_open_cache gives error #
116
###########################################################################
118
--Error ER_GLOBAL_VARIABLE
119
SET @@session.table_open_cache = 0;
122
--echo '#----------------------FN_DYNVARS_001_06------------------------#'
123
####################################################################
124
# Check if the value in GLOBAL Tables matches values in variable #
125
####################################################################
127
SELECT @@global.table_open_cache = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='table_open_cache ';
130
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
131
###################################################################
132
# Check if TRUE and FALSE values can be used on variable #
133
###################################################################
135
SET @@global.table_open_cache = TRUE;
136
SELECT @@global.table_open_cache ;
138
SET @@global.table_open_cache = FALSE;
139
SELECT @@global.table_open_cache ;
142
--echo '#---------------------FN_DYNVARS_001_10----------------------#'
143
##############################################################################
144
# Check if accessing variable without SCOPE points to same session variable #
145
##############################################################################
147
SET @@global.table_open_cache = 10;
148
SELECT @@table_open_cache = @@global.table_open_cache ;
151
--echo '#---------------------FN_DYNVARS_001_11----------------------#'
152
##########################################################################
153
# Check if table_open_cache can be accessed with and without @@ sign #
154
##########################################################################
156
--Error ER_GLOBAL_VARIABLE
157
SET table_open_cache = 8;
158
--Error ER_PARSE_ERROR
159
SET global.table_open_cache = 10;
160
--Error ER_UNKNOWN_TABLE
161
SELECT global.table_open_cache ;
162
--Error ER_BAD_FIELD_ERROR
163
SELECT table_open_cache = @@session.table_open_cache ;
166
##############################
167
# Restore initial value #
168
##############################
170
SET @@global.table_open_cache = @start_value;
171
SELECT @@global.table_open_cache ;
174
##################################################################
175
# END OF table_open_cache TESTS #
176
##################################################################