| 1 |
############## mysql-test\t\table_open_cache_basic.test ####################### |
| 2 |
# # |
| 3 |
# Variable Name: table_open_cache # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: numeric # |
| 7 |
# Default Value: 2000 # |
| 8 |
# Range: 64-524288 # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-13 # |
| 12 |
# Author: Salman # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable table_open_cache # |
| 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#option_mysqld_table_open_cache # |
| 23 |
# # |
| 24 |
############################################################################### |
| 25 |
|
| 26 |
--source include/load_sysvars.inc |
| 27 |
|
| 28 |
######################################################################## |
| 29 |
# START OF table_open_cache TESTS # |
| 30 |
######################################################################## |
| 31 |
|
| 32 |
|
| 33 |
########################################################################## |
| 34 |
# Saving initial value of table_open_cache in a temporary variable # |
| 35 |
########################################################################## |
| 36 |
|
| 37 |
SET @start_value = @@global.table_open_cache ; |
| 38 |
SELECT IF(@@open_files_limit < 5000, 4000, @start_value); |
| 39 |
|
| 40 |
|
| 41 |
--echo '#--------------------FN_DYNVARS_001_01------------------------#' |
| 42 |
######################################################################## |
| 43 |
# Display the DEFAULT value of table_open_cache # |
| 44 |
######################################################################## |
| 45 |
|
| 46 |
SET @@global.table_open_cache = 99; |
| 47 |
SET @@global.table_open_cache = DeFAULT; |
| 48 |
SELECT @@global.table_open_cache; |
| 49 |
|
| 50 |
|
| 51 |
--echo '#---------------------FN_DYNVARS_001_02-------------------------#' |
| 52 |
############################################### |
| 53 |
# Verify default value of variable # |
| 54 |
############################################### |
| 55 |
|
| 56 |
SET @@global.table_open_cache = Default; |
| 57 |
SELECT IF(@@open_files_limit < 5000, 4000, @@global.table_open_cache) = 4000; |
| 58 |
|
| 59 |
--echo '#--------------------FN_DYNVARS_001_03------------------------#' |
| 60 |
######################################################################## |
| 61 |
# Change the value of table_open_cache to a valid value # |
| 62 |
######################################################################## |
| 63 |
|
| 64 |
|
| 65 |
SET @@global.table_open_cache = 8; |
| 66 |
SELECT @@global.table_open_cache ; |
| 67 |
|
| 68 |
SET @@global.table_open_cache = 1; |
| 69 |
SELECT @@global.table_open_cache ; |
| 70 |
|
| 71 |
SET @@global.table_open_cache = 524288; |
| 72 |
SELECT @@global.table_open_cache ; |
| 73 |
|
| 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 ; |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
--echo '#--------------------FN_DYNVARS_001_04-------------------------#' |
| 82 |
####################################################################### |
| 83 |
# Change the value of table_open_cache to invalid value # |
| 84 |
####################################################################### |
| 85 |
|
| 86 |
SET @@global.table_open_cache = -1; |
| 87 |
SELECT @@global.table_open_cache ; |
| 88 |
|
| 89 |
SET @@global.table_open_cache = 524289; |
| 90 |
SELECT @@global.table_open_cache ; |
| 91 |
|
| 92 |
SET @@global.table_open_cache = 100000000000; |
| 93 |
SELECT @@global.table_open_cache ; |
| 94 |
|
| 95 |
SET @@global.table_open_cache = -1024; |
| 96 |
SELECT @@global.table_open_cache ; |
| 97 |
|
| 98 |
SET @@global.table_open_cache = 0; |
| 99 |
SELECT @@global.table_open_cache ; |
| 100 |
|
| 101 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 102 |
SET @@global.table_open_cache = 10000.01; |
| 103 |
|
| 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'; |
| 108 |
|
| 109 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 110 |
SET @@global.table_open_cache = ''; |
| 111 |
|
| 112 |
|
| 113 |
--echo '#-------------------FN_DYNVARS_001_05----------------------------#' |
| 114 |
########################################################################### |
| 115 |
# Test if accessing session table_open_cache gives error # |
| 116 |
########################################################################### |
| 117 |
|
| 118 |
--Error ER_GLOBAL_VARIABLE |
| 119 |
SET @@session.table_open_cache = 0; |
| 120 |
|
| 121 |
|
| 122 |
--echo '#----------------------FN_DYNVARS_001_06------------------------#' |
| 123 |
#################################################################### |
| 124 |
# Check if the value in GLOBAL Tables matches values in variable # |
| 125 |
#################################################################### |
| 126 |
|
| 127 |
--disable_warnings |
| 128 |
SELECT @@global.table_open_cache = VARIABLE_VALUE FROM performance_schema.global_variables WHERE VARIABLE_NAME='table_open_cache'; |
| 129 |
--enable_warnings |
| 130 |
|
| 131 |
|
| 132 |
--echo '#---------------------FN_DYNVARS_001_09----------------------#' |
| 133 |
################################################################### |
| 134 |
# Check if TRUE and FALSE values can be used on variable # |
| 135 |
################################################################### |
| 136 |
|
| 137 |
SET @@global.table_open_cache = TRUE; |
| 138 |
SELECT @@global.table_open_cache ; |
| 139 |
|
| 140 |
SET @@global.table_open_cache = FALSE; |
| 141 |
SELECT @@global.table_open_cache ; |
| 142 |
|
| 143 |
|
| 144 |
--echo '#---------------------FN_DYNVARS_001_10----------------------#' |
| 145 |
############################################################################## |
| 146 |
# Check if accessing variable without SCOPE points to same session variable # |
| 147 |
############################################################################## |
| 148 |
|
| 149 |
SET @@global.table_open_cache = 10; |
| 150 |
SELECT @@table_open_cache = @@global.table_open_cache ; |
| 151 |
|
| 152 |
|
| 153 |
--echo '#---------------------FN_DYNVARS_001_11----------------------#' |
| 154 |
########################################################################## |
| 155 |
# Check if table_open_cache can be accessed with and without @@ sign # |
| 156 |
########################################################################## |
| 157 |
|
| 158 |
--Error ER_GLOBAL_VARIABLE |
| 159 |
SET table_open_cache = 8; |
| 160 |
--Error ER_PARSE_ERROR |
| 161 |
SET global.table_open_cache = 10; |
| 162 |
--Error ER_UNKNOWN_TABLE |
| 163 |
SELECT global.table_open_cache ; |
| 164 |
--Error ER_BAD_FIELD_ERROR |
| 165 |
SELECT table_open_cache; |
| 166 |
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 167 |
SELECT @@session.table_open_cache ; |
| 168 |
|
| 169 |
|
| 170 |
############################## |
| 171 |
# Restore initial value # |
| 172 |
############################## |
| 173 |
|
| 174 |
SET @@global.table_open_cache = @start_value; |
| 175 |
SELECT IF(@@open_files_limit < 5000, 4000, @start_value); |
| 176 |
|
| 177 |
|
| 178 |
################################################################## |
| 179 |
# END OF table_open_cache TESTS # |
| 180 |
################################################################## |
| 181 |
|